mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
test: add reproducer for issue #28225
(cherry picked from commit beba8f2e1e5f08041d2a9955398a64d92dcc75a0)
This commit is contained in:
parent
ee3ed28f42
commit
2cda7651ac
@ -944,6 +944,86 @@ EOF
|
||||
systemd-dissect -U "$imgs/mnt"
|
||||
}
|
||||
|
||||
testcase_free_area_calculation() {
|
||||
local defs imgs output
|
||||
|
||||
if ! command -v mksquashfs >/dev/null; then
|
||||
echo "Skipping free area calculation test without squashfs."
|
||||
return
|
||||
fi
|
||||
|
||||
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 a+rx "$defs"
|
||||
|
||||
# https://github.com/systemd/systemd/issues/28225
|
||||
echo "*** free area calculation ***"
|
||||
|
||||
tee "$defs/00-ESP.conf" <<EOF
|
||||
[Partition]
|
||||
Type = esp
|
||||
Label = ESP
|
||||
Format = vfat
|
||||
|
||||
SizeMinBytes = 128M
|
||||
SizeMaxBytes = 128M
|
||||
|
||||
# Sufficient for testing
|
||||
CopyFiles = /etc:/
|
||||
EOF
|
||||
|
||||
tee "$defs/10-os.conf" <<EOF
|
||||
[Partition]
|
||||
Type = root-${architecture}
|
||||
Label = test
|
||||
Format = squashfs
|
||||
|
||||
Minimize = best
|
||||
# Sufficient for testing
|
||||
CopyFiles = /etc/:/
|
||||
|
||||
VerityMatchKey = os
|
||||
Verity = data
|
||||
EOF
|
||||
|
||||
tee "$defs/11-os-verity.conf" <<EOF
|
||||
[Partition]
|
||||
Type = root-${architecture}-verity
|
||||
Label = test
|
||||
|
||||
Minimize = best
|
||||
|
||||
VerityMatchKey = os
|
||||
Verity = hash
|
||||
EOF
|
||||
|
||||
# Set sector size for VFAT to 512 bytes because there will not be enough FAT clusters otherwise
|
||||
output1=$(SYSTEMD_REPART_MKFS_OPTIONS_VFAT="-S 512" systemd-repart \
|
||||
--definitions="$defs" \
|
||||
--seed="$seed" \
|
||||
--dry-run=no \
|
||||
--empty=create \
|
||||
--size=auto \
|
||||
--sector-size=4096 \
|
||||
--defer-partitions=esp \
|
||||
--json=pretty \
|
||||
"$imgs/zzz")
|
||||
|
||||
# FIXME: the second invocation fails.
|
||||
output2=$(SYSTEMD_REPART_MKFS_OPTIONS_VFAT="-S 512" systemd-repart \
|
||||
--definitions="$defs" \
|
||||
--seed="$seed" \
|
||||
--dry-run=no \
|
||||
--empty=allow \
|
||||
--size=auto \
|
||||
--sector-size=4096 \
|
||||
--defer-partitions=esp \
|
||||
--json=pretty \
|
||||
"$imgs/zzz") || :
|
||||
}
|
||||
|
||||
test_sector() {
|
||||
local defs imgs output loop
|
||||
local start size ratio
|
||||
|
Loading…
x
Reference in New Issue
Block a user