Skip to content

Commit 2fa6459

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) (cherry picked from commit 1211e6c)
1 parent b859991 commit 2fa6459

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

test/units/testsuite-58.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,47 @@ EOF
10881088
assert_in "${loop}p3 : start= *${start}, size= *${size}, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=DB081670-07AE-48CA-9F5E-813D5E40B976, name=\"linux-generic-2\"" "$output"
10891089
}
10901090

1091+
testcase_random_seed() {
1092+
local defs imgs output
1093+
1094+
# For issue #34257
1095+
1096+
defs="$(mktemp --directory "/tmp/test-repart.defs.XXXXXXXXXX")"
1097+
imgs="$(mktemp --directory "/var/tmp/test-repart.imgs.XXXXXXXXXX")"
1098+
# shellcheck disable=SC2064
1099+
trap "rm -rf '$defs' '$imgs'" RETURN
1100+
chmod 0755 "$defs"
1101+
1102+
tee "$defs/root.conf" <<EOF
1103+
[Partition]
1104+
Type=root
1105+
EOF
1106+
1107+
tee "$defs/home.conf" <<EOF
1108+
[Partition]
1109+
Type=home
1110+
Label=home-first
1111+
EOF
1112+
1113+
tee "$defs/swap.conf" <<EOF
1114+
[Partition]
1115+
Type=swap
1116+
SizeMaxBytes=64M
1117+
PaddingMinBytes=92M
1118+
EOF
1119+
1120+
systemd-repart --definitions="$defs" \
1121+
--empty=create \
1122+
--size=1G \
1123+
--dry-run=no \
1124+
--seed=random \
1125+
--json=pretty \
1126+
"$imgs/zzz"
1127+
1128+
sfdisk -d "$imgs/zzz"
1129+
[[ "$(sfdisk -d "$imgs/zzz" | grep -F 'uuid=' | awk '{ print $8 }' | sort -u | wc -l)" == "3" ]]
1130+
}
1131+
10911132
test_basic
10921133
test_dropin
10931134
test_multiple_definitions
@@ -1099,6 +1140,7 @@ test_zero_uuid
10991140
test_verity
11001141
test_issue_24786
11011142
test_minimize
1143+
testcase_random_seed
11021144

11031145
# Valid block sizes on the Linux block layer are >= 512 and <= PAGE_SIZE, and
11041146
# must be powers of 2. Which leaves exactly four different ones to test on

0 commit comments

Comments
 (0)