test: add test case for systemd-repart --seed=random

For issue #34257.
This commit is contained in:
Yu Watanabe
2024-09-05 18:01:42 +09:00
parent b8a8000aba
commit 56d6ebd404
+43
View File
@@ -1347,6 +1347,49 @@ EOF
done
}
testcase_random_seed() {
local defs imgs output
# For issue #34257
defs="$(mktemp --directory "/tmp/test-repart.defs.XXXXXXXXXX")"
imgs="$(mktemp --directory "/var/tmp/test-repart.imgs.XXXXXXXXXX")"
# shellcheck disable=SC2064
trap "rm -rf '$defs' '$imgs'" RETURN
chmod 0755 "$defs"
tee "$defs/root.conf" <<EOF
[Partition]
Type=root
EOF
tee "$defs/home.conf" <<EOF
[Partition]
Type=home
Label=home-first
EOF
tee "$defs/swap.conf" <<EOF
[Partition]
Type=swap
SizeMaxBytes=64M
PaddingMinBytes=92M
EOF
systemd-repart --offline="$OFFLINE" \
--definitions="$defs" \
--empty=create \
--size=1G \
--dry-run=no \
--seed=random \
--offline="$OFFLINE" \
--json=pretty \
"$imgs/zzz"
sfdisk -d "$imgs/zzz"
[[ "$(sfdisk -d "$imgs/zzz" | grep -F 'uuid=' | awk '{ print $8 }' | sort -u | wc -l)" == "3" ]]
}
OFFLINE="yes"
run_testcases