]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use -force with unsquashfs for test reruns
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 6 Dec 2025 00:39:04 +0000 (00:39 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Dec 2025 05:41:59 +0000 (14:41 +0900)
In case a test is reran or a directory reused, overwrite it
instead of failing

test/units/TEST-07-PID1.delegate-namespaces.sh
test/units/TEST-07-PID1.private-pids.sh
test/units/TEST-29-PORTABLE.directory.sh
test/units/TEST-43-PRIVATEUSER-UNPRIV.sh
test/units/TEST-50-DISSECT.dissect.sh

index 68ade8fc41910d270b3e544e3f41293d0316add2..61d09866850c5d85b6bcd58e96b12ced7d4363d1 100755 (executable)
@@ -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 \
index ae7e4538b395a75031c145e4d33c936b1639ee9f..e3c4fdf17c5c3e014fa7f228a5b5fa506ccb793e 100755 (executable)
@@ -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 \
index e8ceafb28ece7c395d15105d150e304e4a74e79f..57fed2d4a55bb9f018d20d01d9aaf5f0ccfb9fc5 100755 (executable)
@@ -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
 
index b15d62d4f91dddb96b98744a112d87d2dbd13fc9..fa3a090b055f1b11c6b1d90b55b64090b8016b65 100755 (executable)
@@ -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 \
index 5bd95fbe0d842ec8966154a83c79992b93c68cc2..f702cd135445fadc64b962b52475cf23642ab7e4 100755 (executable)
@@ -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