Skip to content

Commit 1211e6c

Browse files
yuwatabluca
authored andcommitted
test: add test case for systemd-repart --seed=random
For issue #34257. (cherry picked from commit 56d6ebd) (cherry picked from commit 69282da) (cherry picked from commit fbfe769)
1 parent ed474d3 commit 1211e6c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/units/testsuite-58.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,49 @@ testcase_dropped_partitions() {
11901190
[[ "$(sfdisk -q -l "$image" | grep -c "$image")" -eq 2 ]]
11911191
}
11921192

1193+
testcase_random_seed() {
1194+
local defs imgs output
1195+
1196+
# For issue #34257
1197+
1198+
defs="$(mktemp --directory "/tmp/test-repart.defs.XXXXXXXXXX")"
1199+
imgs="$(mktemp --directory "/var/tmp/test-repart.imgs.XXXXXXXXXX")"
1200+
# shellcheck disable=SC2064
1201+
trap "rm -rf '$defs' '$imgs'" RETURN
1202+
chmod 0755 "$defs"
1203+
1204+
tee "$defs/root.conf" <<EOF
1205+
[Partition]
1206+
Type=root
1207+
EOF
1208+
1209+
tee "$defs/home.conf" <<EOF
1210+
[Partition]
1211+
Type=home
1212+
Label=home-first
1213+
EOF
1214+
1215+
tee "$defs/swap.conf" <<EOF
1216+
[Partition]
1217+
Type=swap
1218+
SizeMaxBytes=64M
1219+
PaddingMinBytes=92M
1220+
EOF
1221+
1222+
systemd-repart --offline="$OFFLINE" \
1223+
--definitions="$defs" \
1224+
--empty=create \
1225+
--size=1G \
1226+
--dry-run=no \
1227+
--seed=random \
1228+
--offline="$OFFLINE" \
1229+
--json=pretty \
1230+
"$imgs/zzz"
1231+
1232+
sfdisk -d "$imgs/zzz"
1233+
[[ "$(sfdisk -d "$imgs/zzz" | grep -F 'uuid=' | awk '{ print $8 }' | sort -u | wc -l)" == "3" ]]
1234+
}
1235+
11931236
OFFLINE="yes"
11941237
run_testcases
11951238

0 commit comments

Comments
 (0)