test: call mksquashfs with -noappend to be safe on reruns

If the test VM reboots and the test re-runs, creating the images
fails as they already exist:

[  218.227766] TEST-50-DISSECT.sh[889]: + mksquashfs testkit/ testkit.raw
[  218.238754] TEST-50-DISSECT.sh[2964]: FATAL ERROR: Could not read $HOME, use -recovery-path or -no-recovery options
[  218.239284] TEST-50-DISSECT.sh[2964]: Found a valid exportable SQUASHFS superblock on testkit.raw.
[  218.239554] TEST-50-DISSECT.sh[2964]: 	Compression used gzip
[  218.240176] TEST-50-DISSECT.sh[2964]: 	Inodes are compressed
[  218.240459] TEST-50-DISSECT.sh[2964]: 	Data is compressed
[  218.241072] TEST-50-DISSECT.sh[2964]: 	Fragments are compressed
[  218.241526] TEST-50-DISSECT.sh[2964]: 	Xattrs are compressed
[  218.241953] TEST-50-DISSECT.sh[2964]: 	Fragments are present in the filesystem
[  218.242411] TEST-50-DISSECT.sh[2964]: 	Always-use-fragments option is not specified
[  218.242843] TEST-50-DISSECT.sh[2964]: 	Duplicates are removed
[  218.243560] TEST-50-DISSECT.sh[2964]: 	Xattrs are stored
[  218.243889] TEST-50-DISSECT.sh[2964]: 	Filesystem size 0.38 Kbytes (0.00 Mbytes)
[  218.244563] TEST-50-DISSECT.sh[2964]: 	Block size 131072
[  218.245051] TEST-50-DISSECT.sh[2964]: 	Number of fragments 1
[  218.245512] TEST-50-DISSECT.sh[2964]: 	Number of inodes 6
[  218.245851] TEST-50-DISSECT.sh[2964]: 	Number of ids 1
[  218.246393] TEST-50-DISSECT.sh[2964]: Parallel mksquashfs: Using 2 processors
[  218.246820] TEST-50-DISSECT.sh[2964]: Scanning existing filesystem...
[  218.247286] TEST-50-DISSECT.sh[2964]: Read existing filesystem, 5 inodes scanned
[  218.252974] TEST-50-DISSECT.sh[2964]: Appending to existing 4.0 filesystem on testkit.raw, block size 131072
[  218.253593] TEST-50-DISSECT.sh[2964]: All -b, -noI, -noD, -noF, -noX, -noId, -no-duplicates, -no-fragments,
[  218.253848] TEST-50-DISSECT.sh[2964]: -always-use-fragments, -exportable and -comp options ignored
[  218.257196] TEST-50-DISSECT.sh[2964]: If appending is not wanted, please re-run with -noappend specified!

https://github.com/systemd/systemd/actions/runs/17674609143/job/50233691148?pr=38867
This commit is contained in:
Luca Boccassi
2025-09-15 14:42:03 +01:00
parent 27833c409d
commit 876c4c5129
+7 -7
View File
@@ -371,7 +371,7 @@ systemctl start testservice-50d.service
# Mount twice to exercise mount-beneath (on kernel 6.5+, on older kernels it will just overmount)
mkdir -p /tmp/wrong/foo
mksquashfs /tmp/wrong/foo /tmp/wrong.raw
mksquashfs /tmp/wrong/foo /tmp/wrong.raw -noappend
systemctl mount-image --mkdir testservice-50d.service /tmp/wrong.raw /tmp/img
test "$(systemctl show -P SubState testservice-50d.service)" = "running"
systemctl mount-image --mkdir testservice-50d.service "$MINIMAL_IMAGE.raw" /tmp/img root:nosuid
@@ -638,14 +638,14 @@ ExecStart=bash -x -c ' \\
while true; do sleep 1; done; \\
'
EOF
mksquashfs "$VDIR/${VBASE}_1" "$VDIR2/${VBASE}_1.raw"
mksquashfs "$VDIR/${VBASE}_1" "$VDIR2/${VBASE}_1.raw" -noappend
systemctl start testservice-50h.service
systemctl is-active testservice-50h.service
# First reload should pick up the v1 marker
systemctl reload testservice-50h.service
grep -q -F "${VBASE}_1.marker" /tmp/markers/50h
# Second reload should pick up the v2 marker
mksquashfs "$VDIR/${VBASE}_2" "$VDIR2/${VBASE}_2.raw"
mksquashfs "$VDIR/${VBASE}_2" "$VDIR2/${VBASE}_2.raw" -noappend
systemctl reload testservice-50h.service
grep -q -F "${VBASE}_2.marker" /tmp/markers/50h
# Test that removing all the extensions don't cause any issues
@@ -750,11 +750,11 @@ if [ "$verity_sig_supported" -eq 1 ]; then
veritysetup status "$(cat "$MINIMAL_IMAGE.roothash")-verity" | grep -q "verified (with signature)"
fi
# First reload should pick up the v1 marker
mksquashfs "$VDIR/${VBASE}_1" "$VDIR2/${VBASE}_1.raw"
mksquashfs "$VDIR/${VBASE}_1" "$VDIR2/${VBASE}_1.raw" -noappend
systemctl reload testservice-50k.service
grep -q -F "${VBASE}_1.marker" /tmp/markers/50k
# Second reload should pick up the v2 marker
mksquashfs "$VDIR/${VBASE}_2" "$VDIR2/${VBASE}_2.raw"
mksquashfs "$VDIR/${VBASE}_2" "$VDIR2/${VBASE}_2.raw" -noappend
systemctl reload testservice-50k.service
grep -q -F "${VBASE}_2.marker" /tmp/markers/50k
# Test that removing all the extensions don't cause any issues
@@ -917,7 +917,7 @@ mkdir -p /run/extensions/ testkit/usr/lib/extension-release.d/
echo "ID=_any" >testkit/usr/lib/extension-release.d/extension-release.testkit
echo "ARCHITECTURE=_any" >>testkit/usr/lib/extension-release.d/extension-release.testkit
echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile
mksquashfs testkit/ testkit.raw
mksquashfs testkit/ testkit.raw -noappend
cp testkit.raw /run/extensions/
unsquashfs -l /run/extensions/testkit.raw
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service'
@@ -933,7 +933,7 @@ mkdir -p /run/confexts/ testjob/etc/extension-release.d/
echo "ID=_any" >testjob/etc/extension-release.d/extension-release.testjob
echo "ARCHITECTURE=_any" >>testjob/etc/extension-release.d/extension-release.testjob
echo "MARKER_CONFEXT_123" >testjob/etc/testfile
mksquashfs testjob/ testjob.raw
mksquashfs testjob/ testjob.raw -noappend
cp testjob.raw /run/confexts/
unsquashfs -l /run/confexts/testjob.raw
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system'