diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-05 10:58:29 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-05 11:01:42 +0200 |
commit | 56d6ebd40468e2a743b39ad7d87b0675bdf9a042 (patch) | |
tree | 58495be32ff632d0f7104193aa1240111e466f8f /test | |
parent | repart: initialize seed earlier (diff) | |
download | systemd-56d6ebd40468e2a743b39ad7d87b0675bdf9a042.tar.xz systemd-56d6ebd40468e2a743b39ad7d87b0675bdf9a042.zip |
test: add test case for systemd-repart --seed=random
For issue #34257.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-58-REPART.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/units/TEST-58-REPART.sh b/test/units/TEST-58-REPART.sh index b2a3be686c..6110dc4e52 100755 --- a/test/units/TEST-58-REPART.sh +++ b/test/units/TEST-58-REPART.sh @@ -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 |