Skip to content

Commit fbfe769

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)
1 parent 175dafa commit fbfe769

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
@@ -1288,6 +1288,49 @@ testcase_dropped_partitions() {
12881288
[[ "$(sfdisk -q -l "$image" | grep -c "$image")" -eq 2 ]]
12891289
}
12901290

1291+
testcase_random_seed() {
1292+
local defs imgs output
1293+
1294+
# For issue #34257
1295+
1296+
defs="$(mktemp --directory "/tmp/test-repart.defs.XXXXXXXXXX")"
1297+
imgs="$(mktemp --directory "/var/tmp/test-repart.imgs.XXXXXXXXXX")"
1298+
# shellcheck disable=SC2064
1299+
trap "rm -rf '$defs' '$imgs'" RETURN
1300+
chmod 0755 "$defs"
1301+
1302+
tee "$defs/root.conf" <<EOF
1303+
[Partition]
1304+
Type=root
1305+
EOF
1306+
1307+
tee "$defs/home.conf" <<EOF
1308+
[Partition]
1309+
Type=home
1310+
Label=home-first
1311+
EOF
1312+
1313+
tee "$defs/swap.conf" <<EOF
1314+
[Partition]
1315+
Type=swap
1316+
SizeMaxBytes=64M
1317+
PaddingMinBytes=92M
1318+
EOF
1319+
1320+
systemd-repart --offline="$OFFLINE" \
1321+
--definitions="$defs" \
1322+
--empty=create \
1323+
--size=1G \
1324+
--dry-run=no \
1325+
--seed=random \
1326+
--offline="$OFFLINE" \
1327+
--json=pretty \
1328+
"$imgs/zzz"
1329+
1330+
sfdisk -d "$imgs/zzz"
1331+
[[ "$(sfdisk -d "$imgs/zzz" | grep -F 'uuid=' | awk '{ print $8 }' | sort -u | wc -l)" == "3" ]]
1332+
}
1333+
12911334
OFFLINE="yes"
12921335
run_testcases
12931336

0 commit comments

Comments
 (0)