From c89b3e1dfda482d4ba657f26ebb46534c8512b09 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 2 Apr 2024 20:37:30 +0200 Subject: [PATCH] test: Always exit with 77 if we skip a test 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 | 2 +- test/units/testsuite-43.sh | 2 +- test/units/testsuite-46.sh | 2 +- test/units/testsuite-55.sh | 2 +- test/units/testsuite-58.sh | 2 +- test/units/testsuite-62.sh | 4 ++-- test/units/testsuite-72.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/units/testsuite-08.sh b/test/units/testsuite-08.sh index 5c6b4cee790..58d9bea195f 100755 --- a/test/units/testsuite-08.sh +++ b/test/units/testsuite-08.sh @@ -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) diff --git a/test/units/testsuite-43.sh b/test/units/testsuite-43.sh index 4f31a33c343..c1204685938 100755 --- a/test/units/testsuite-43.sh +++ b/test/units/testsuite-43.sh @@ -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 diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index 7a2bee81795..d9ba83aa825 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -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() { diff --git a/test/units/testsuite-55.sh b/test/units/testsuite-55.sh index 3e549dd7dbe..e5d930175f7 100755 --- a/test/units/testsuite-55.sh +++ b/test/units/testsuite-55.sh @@ -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 diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh index c64b2039f30..bebe7b727b6 100755 --- a/test/units/testsuite-58.sh +++ b/test/units/testsuite-58.sh @@ -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 diff --git a/test/units/testsuite-62.sh b/test/units/testsuite-62.sh index 0dbedc4c868..84c92247b81 100755 --- a/test/units/testsuite-62.sh +++ b/test/units/testsuite-62.sh @@ -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 diff --git a/test/units/testsuite-72.sh b/test/units/testsuite-72.sh index 587eb695409..5e658e04856 100755 --- a/test/units/testsuite-72.sh +++ b/test/units/testsuite-72.sh @@ -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 -- 2.47.3