Skip to content

Commit 514168f

Browse files
mrc0mmandbluca
authored andcommitted
test: bump the data partition size if we don't strip binaries
so we can run TEST-24 under sanitizers as well. Also, when at it, use the 'named-fields' sfdisk format to make the code a bit more descriptive without needing a manual. (cherry picked from commit 98b2793)
1 parent 05a9dfa commit 514168f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

test/test-functions

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,33 +1277,38 @@ create_empty_image() {
12771277
exit 1
12781278
fi
12791279

1280-
local size=500
1280+
# Partition sizes are in MiBs
1281+
local root_size=500
1282+
local data_size=50
12811283
if ! get_bool "$NO_BUILD"; then
12821284
if meson configure "${BUILD_DIR:?}" | grep 'static-lib\|standalone-binaries' | awk '{ print $2 }' | grep -q 'true'; then
1283-
size=$((size+=200))
1285+
root_size=$((root_size+=200))
12841286
fi
12851287
if meson configure "${BUILD_DIR:?}" | grep 'link-.*-shared' | awk '{ print $2 }' | grep -q 'false'; then
1286-
size=$((size+=200))
1288+
root_size=$((root_size+=200))
12871289
fi
12881290
if get_bool "$IS_BUILT_WITH_COVERAGE"; then
1289-
size=$((size+=250))
1291+
root_size=$((root_size+=250))
12901292
fi
12911293
fi
12921294
if ! get_bool "$STRIP_BINARIES"; then
1293-
size=$((4 * size))
1295+
root_size=$((4 * root_size))
1296+
data_size=$((2 * data_size))
12941297
fi
12951298

1296-
echo "Setting up ${IMAGE_PUBLIC:?} (${size} MB)"
1299+
echo "Setting up ${IMAGE_PUBLIC:?} (${root_size} MB)"
12971300
rm -f "${IMAGE_PRIVATE:?}" "$IMAGE_PUBLIC"
12981301

12991302
# Create the blank file to use as a root filesystem
1300-
truncate -s "${size}M" "$IMAGE_PUBLIC"
1303+
truncate -s "${root_size}M" "$IMAGE_PUBLIC"
13011304

13021305
LOOPDEV=$(losetup --show -P -f "$IMAGE_PUBLIC")
13031306
[ -b "$LOOPDEV" ] || return 1
1307+
# Create two partitions - a root one and a data one (utilized by some tests)
13041308
sfdisk "$LOOPDEV" <<EOF
1305-
,$((size - 50))M,L,*
1306-
,
1309+
label: gpt
1310+
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 name=root size=$((root_size - data_size))M bootable
1311+
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 name=data
13071312
EOF
13081313

13091314
udevadm settle

0 commit comments

Comments
 (0)