richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
8d419f
From 332ac78ab1febc89e04dc095bdd2259044f7d6b6 Mon Sep 17 00:00:00 2001
8d419f
From: Frantisek Sumsal <frantisek@sumsal.cz>
8d419f
Date: Thu, 7 Jul 2022 14:13:32 +0200
8d419f
Subject: [PATCH] test: bump the data partition size if we don't strip binaries
8d419f
8d419f
so we can run TEST-24 under sanitizers as well.
8d419f
8d419f
Also, when at it, use the 'named-fields' sfdisk format to make the code
8d419f
a bit more descriptive without needing a manual.
8d419f
8d419f
(cherry picked from commit 98b27937cb02dac98d8a9f0c48ba677b45df0831)
8d419f
8d419f
Related: #2087652
8d419f
---
8d419f
 test/test-functions | 23 ++++++++++++++---------
8d419f
 1 file changed, 14 insertions(+), 9 deletions(-)
8d419f
8d419f
diff --git a/test/test-functions b/test/test-functions
8d419f
index b596ce1382..b0f3b28def 100644
8d419f
--- a/test/test-functions
8d419f
+++ b/test/test-functions
8d419f
@@ -1194,33 +1194,38 @@ create_empty_image() {
8d419f
         exit 1
8d419f
     fi
8d419f
 
8d419f
-    local size=500
8d419f
+    # Partition sizes are in MiBs
8d419f
+    local root_size=500
8d419f
+    local data_size=50
8d419f
     if ! get_bool "$NO_BUILD"; then
8d419f
         if meson configure "${BUILD_DIR:?}" | grep 'static-lib\|standalone-binaries' | awk '{ print $2 }' | grep -q 'true'; then
8d419f
-            size=$((size+=200))
8d419f
+            root_size=$((root_size+=200))
8d419f
         fi
8d419f
         if meson configure "${BUILD_DIR:?}" | grep 'link-.*-shared' | awk '{ print $2 }' | grep -q 'false'; then
8d419f
-            size=$((size+=200))
8d419f
+            root_size=$((root_size+=200))
8d419f
         fi
8d419f
         if get_bool "$IS_BUILT_WITH_COVERAGE"; then
8d419f
-            size=$((size+=250))
8d419f
+            root_size=$((root_size+=250))
8d419f
         fi
8d419f
     fi
8d419f
     if ! get_bool "$STRIP_BINARIES"; then
8d419f
-        size=$((4 * size))
8d419f
+        root_size=$((4 * root_size))
8d419f
+        data_size=$((2 * data_size))
8d419f
     fi
8d419f
 
8d419f
-    echo "Setting up ${IMAGE_PUBLIC:?} (${size} MB)"
8d419f
+    echo "Setting up ${IMAGE_PUBLIC:?} (${root_size} MB)"
8d419f
     rm -f "${IMAGE_PRIVATE:?}" "$IMAGE_PUBLIC"
8d419f
 
8d419f
     # Create the blank file to use as a root filesystem
8d419f
-    truncate -s "${size}M" "$IMAGE_PUBLIC"
8d419f
+    truncate -s "${root_size}M" "$IMAGE_PUBLIC"
8d419f
 
8d419f
     LOOPDEV=$(losetup --show -P -f "$IMAGE_PUBLIC")
8d419f
     [ -b "$LOOPDEV" ] || return 1
8d419f
+    # Create two partitions - a root one and a data one (utilized by some tests)
8d419f
     sfdisk "$LOOPDEV" <
8d419f
-,$((size - 50))M,L,*
8d419f
-,
8d419f
+label: gpt
8d419f
+type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 name=root size=$((root_size - data_size))M bootable
8d419f
+type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 name=data
8d419f
 EOF
8d419f
 
8d419f
     udevadm settle