test: Always exit with 77 if we skip a test
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Apr 2024 18:37:30 +0000 (20:37 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 00:14:15 +0000 (09:14 +0900)
Prep work for running the integration tests with meson, which requires
tests to exit with 77 to indicate they are skipped.

Note this only deals with the easy cases where there's only tests. The
hard ones where there's subtests of which only some are skipped are left
for another PR.

test/units/testsuite-08.sh
test/units/testsuite-43.sh
test/units/testsuite-46.sh
test/units/testsuite-55.sh
test/units/testsuite-58.sh
test/units/testsuite-62.sh
test/units/testsuite-72.sh

index 5c6b4cee7908e124dcabc2d172390cc4110d5961..58d9bea195f5ac2ff2995bb9b00fb74d7d86f3bf 100755 (executable)
@@ -13,7 +13,7 @@ fi
 if [[ "$(systemctl show -P InitRDTimestampMonotonic)" -eq 0 ]]; then
     echo "systemd didn't run in the initrd, skipping the test"
     touch /skipped
-    exit 0
+    exit 77
 fi
 
 # We should've created a mount under /run in initrd (see the other half of the test)
index 4f31a33c343a52ba9c7e24da45b592798b9d0eac..c1204685938ca6b1dfd1f92a824300fdc4c92ab6 100755 (executable)
@@ -8,7 +8,7 @@ set -o pipefail
 
 if [[ "$(sysctl -ne kernel.apparmor_restrict_unprivileged_userns)" -eq 1 ]]; then
     echo "Cannot create unprivileged user namespaces" >/skipped
-    exit 0
+    exit 77
 fi
 
 systemd-analyze log-level debug
index 7a2bee817956f6b5eb9228ba0eb74798f56ab3db..d9ba83aa8255d379cfb82929998e045c2360234e 100755 (executable)
@@ -6,7 +6,7 @@ set -o pipefail
 # Check if homectl is installed, and if it isn't bail out early instead of failing
 if ! test -x /usr/bin/homectl ; then
         echo "no homed" >/skipped
-        exit 0
+        exit 77
 fi
 
 inspect() {
index 3e549dd7dbee1e8837f1d7969ee0b23246557bc9..e5d930175f7da1fc9a79b11946ea5f7dbf154ec8 100755 (executable)
@@ -16,7 +16,7 @@ test "$(cat /sys/fs/cgroup/init.scope/memory.high)" != "max"
 [[ "$(get_cgroup_hierarchy)" == "unified" ]] || echo "no cgroupsv2" >>/skipped
 [[ -x /usr/lib/systemd/systemd-oomd ]] || echo "no oomd" >>/skipped
 if [[ -s /skipped ]]; then
-    exit 0
+    exit 77
 fi
 
 rm -rf /run/systemd/system/testsuite-55-testbloat.service.d
index c64b2039f300f1f5346a063e37b1467c698bd2af..bebe7b727b62070d74e7864b46e7c6f78c1aa2d3 100755 (executable)
@@ -9,7 +9,7 @@ set -o pipefail
 
 if ! command -v systemd-repart >/dev/null; then
     echo "no systemd-repart" >/skipped
-    exit 0
+    exit 77
 fi
 
 # shellcheck source=test/units/test-control.sh
index 0dbedc4c868408e0343535eaf17f1c34b5c1c7e4..84c92247b81ddb9d71f2e45faad500364f5a8db6 100755 (executable)
@@ -44,12 +44,12 @@ MINOR_REQUIRED=7
 
 if [[ "$KERNEL_MAJOR" -lt $MAJOR_REQUIRED || ("$KERNEL_MAJOR" -eq $MAJOR_REQUIRED && "$KERNEL_MINOR" -lt $MINOR_REQUIRED) ]]; then
     echo "kernel is not 5.7+" >>/skipped
-    exit 0
+    exit 77
 fi
 
 if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK"; then
     echo "bpf-framework is disabled" >>/skipped
-    exit 0
+    exit 77
 fi
 
 trap teardown EXIT
index 587eb695409ea15cbe193886301229c0f49ec394..5e658e04856e287753eb52b91300b247db07a92d 100755 (executable)
@@ -16,7 +16,7 @@ export SYSTEMD_LOG_LEVEL=debug
 
 if [[ ! -x "$SYSUPDATE" ]]; then
     echo "no systemd-sysupdate" >/skipped
-    exit 0
+    exit 77
 fi
 
 # Loopback devices may not be supported. They are used because sfdisk cannot