From: Adrian Vovk Date: Wed, 4 Sep 2024 03:48:28 +0000 (-0400) Subject: repart: Add tests for supplement partitions X-Git-Tag: v257-rc1~415^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F34040%2Fhead;p=thirdparty%2Fsystemd.git repart: Add tests for supplement partitions --- diff --git a/test/units/TEST-58-REPART.sh b/test/units/TEST-58-REPART.sh index bac90649ce0..6f00767c2fc 100755 --- a/test/units/TEST-58-REPART.sh +++ b/test/units/TEST-58-REPART.sh @@ -29,6 +29,9 @@ if ! systemd-detect-virt --quiet --container; then udevadm control --log-level debug fi +esp_guid=C12A7328-F81F-11D2-BA4B-00A0C93EC93B +xbootldr_guid=BC13C2FF-59E6-4262-A352-B275FD6F7172 + machine="$(uname -m)" if [ "${machine}" = "x86_64" ]; then root_guid=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 @@ -1432,6 +1435,82 @@ EOF systemd-dissect -U "$imgs/mnt" } +testcase_fallback_partitions() { + local workdir image defs + + workdir="$(mktemp --directory "/tmp/test-repart.fallback.XXXXXXXXXX")" + # shellcheck disable=SC2064 + trap "rm -rf '${workdir:?}'" RETURN + + image="$workdir/image.img" + defs="$workdir/defs" + mkdir "$defs" + + tee "$defs/10-esp.conf" < big ESP should be created + + systemd-repart --empty=create --size=auto --dry-run=no --definitions="$defs" "$image" + + output=$(sfdisk -d "$image") + assert_in "${image}1 : start= 2048, size= 204800, type=${esp_guid}" "$output" + assert_not_in "${image}2" "$output" + + # Disk with small ESP => ESP grows + + sfdisk "$image" < XBOOTLDR created + + truncate -s 150M "$image" + sfdisk "$image" < XBOOTLDR grows, small ESP created + + sfdisk "$image" <