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.
This commit is contained in:
Daan De Meyer 2024-04-02 20:37:30 +02:00 committed by Yu Watanabe
parent 52c15e9c9b
commit c89b3e1dfd
7 changed files with 8 additions and 8 deletions

View file

@ -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)

View file

@ -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

View file

@ -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() {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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