test: use -force with unsquashfs for test reruns

In case a test is reran or a directory reused, overwrite it
instead of failing
This commit is contained in:
Luca Boccassi
2025-12-09 14:41:59 +09:00
committed by Yu Watanabe
parent 2abb433ca1
commit af80c9c224
5 changed files with 10 additions and 10 deletions
@@ -70,7 +70,7 @@ testcase_user_manager() {
}
testcase_multiple_features() {
unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw
systemd-run \
-p PrivatePIDs=yes \
+1 -1
View File
@@ -90,7 +90,7 @@ EOF
}
testcase_multiple_features() {
unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw
systemd-run \
-p PrivatePIDs=yes \
+2 -2
View File
@@ -17,8 +17,8 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
ARGS+=(--profile=trusted)
fi
unsquashfs -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw
unsquashfs -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw
unsquashfs -force -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw
unsquashfs -force -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw
portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime /tmp/minimal_0 minimal-app0
+2 -2
View File
@@ -113,7 +113,7 @@ if sysctl kernel.dmesg_restrict=0; then
dmesg)
fi
unsquashfs -no-xattrs -d /tmp/img /usr/share/minimal_0.raw
unsquashfs -force -no-xattrs -d /tmp/img /usr/share/minimal_0.raw
runas testuser systemd-run --wait --user --unit=test-root-dir \
-p RootDirectory=/tmp/img \
grep MARKER=1 /etc/os-release
@@ -128,7 +128,7 @@ umount /tmp/img_bind
# Unprivileged overlayfs was added to Linux 5.11, so try to detect it first
mkdir -p /tmp/a /tmp/b /tmp/c
if unshare --mount --user --map-root-user mount -t overlay overlay /tmp/c -o lowerdir=/tmp/a:/tmp/b; then
unsquashfs -no-xattrs -d /tmp/app2 /tmp/app1.raw
unsquashfs -force -no-xattrs -d /tmp/app2 /tmp/app1.raw
runas testuser systemd-run --wait --user --unit=test-extension-dir \
-p ExtensionDirectories=/tmp/app2 \
-p TemporaryFileSystem=/run -p RootDirectory=/tmp/img \
+4 -4
View File
@@ -704,7 +704,7 @@ grep -q -F "MARKER=1" /tmp/markers/50i
systemctl stop testservice-50i.service
rm -f /run/systemd/system/testservice-50i.service
unsquashfs -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw"
unsquashfs -force -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw"
cat >/run/systemd/system/testservice-50j.service <<EOF
[Service]
Type=notify-reload
@@ -903,7 +903,7 @@ systemd-confext status
systemd-confext unmerge
rm -rf /run/confexts/
unsquashfs -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw"
unsquashfs -force -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw"
systemd-run --unit=test-root-ephemeral \
-p RootDirectory=/tmp/img \
-p RootEphemeral=yes \
@@ -935,7 +935,7 @@ echo "ARCHITECTURE=_any" >>testkit/usr/lib/extension-release.d/extension-release
echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile
mksquashfs testkit/ testkit.raw -noappend
cp testkit.raw /run/extensions/
unsquashfs -l /run/extensions/testkit.raw
unsquashfs -force -l /run/extensions/testkit.raw
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service'
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for system'
systemd-sysext merge
@@ -951,7 +951,7 @@ echo "ARCHITECTURE=_any" >>testjob/etc/extension-release.d/extension-release.tes
echo "MARKER_CONFEXT_123" >testjob/etc/testfile
mksquashfs testjob/ testjob.raw -noappend
cp testjob.raw /run/confexts/
unsquashfs -l /run/confexts/testjob.raw
unsquashfs -force -l /run/confexts/testjob.raw
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system'
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for portable service'
systemd-confext merge