Skip to content

Commit

Permalink
test: add test case for systemd-repart --seed=random
Browse files Browse the repository at this point in the history
For issue #34257.

(cherry picked from commit 56d6ebd40468e2a743b39ad7d87b0675bdf9a042)
(cherry picked from commit 69282da9aab90c2dc1e440b04af5b2163779515a)
(cherry picked from commit fbfe769)
  • Loading branch information
yuwata authored and bluca committed Sep 11, 2024
1 parent ed474d3 commit 1211e6c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/units/testsuite-58.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,49 @@ testcase_dropped_partitions() {
[[ "$(sfdisk -q -l "$image" | grep -c "$image")" -eq 2 ]]
}

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

Expand Down

0 comments on commit 1211e6c

Please sign in to comment.