1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-26 17:27:41 +03:00

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 if [[ "$(systemctl show -P InitRDTimestampMonotonic)" -eq 0 ]]; then
echo "systemd didn't run in the initrd, skipping the test" echo "systemd didn't run in the initrd, skipping the test"
touch /skipped touch /skipped
exit 0 exit 77
fi fi
# We should've created a mount under /run in initrd (see the other half of the test) # 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 if [[ "$(sysctl -ne kernel.apparmor_restrict_unprivileged_userns)" -eq 1 ]]; then
echo "Cannot create unprivileged user namespaces" >/skipped echo "Cannot create unprivileged user namespaces" >/skipped
exit 0 exit 77
fi fi
systemd-analyze log-level debug 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 # Check if homectl is installed, and if it isn't bail out early instead of failing
if ! test -x /usr/bin/homectl ; then if ! test -x /usr/bin/homectl ; then
echo "no homed" >/skipped echo "no homed" >/skipped
exit 0 exit 77
fi fi
inspect() { 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 [[ "$(get_cgroup_hierarchy)" == "unified" ]] || echo "no cgroupsv2" >>/skipped
[[ -x /usr/lib/systemd/systemd-oomd ]] || echo "no oomd" >>/skipped [[ -x /usr/lib/systemd/systemd-oomd ]] || echo "no oomd" >>/skipped
if [[ -s /skipped ]]; then if [[ -s /skipped ]]; then
exit 0 exit 77
fi fi
rm -rf /run/systemd/system/testsuite-55-testbloat.service.d 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 if ! command -v systemd-repart >/dev/null; then
echo "no systemd-repart" >/skipped echo "no systemd-repart" >/skipped
exit 0 exit 77
fi fi
# shellcheck source=test/units/test-control.sh # 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 if [[ "$KERNEL_MAJOR" -lt $MAJOR_REQUIRED || ("$KERNEL_MAJOR" -eq $MAJOR_REQUIRED && "$KERNEL_MINOR" -lt $MINOR_REQUIRED) ]]; then
echo "kernel is not 5.7+" >>/skipped echo "kernel is not 5.7+" >>/skipped
exit 0 exit 77
fi fi
if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK"; then if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK"; then
echo "bpf-framework is disabled" >>/skipped echo "bpf-framework is disabled" >>/skipped
exit 0 exit 77
fi fi
trap teardown EXIT trap teardown EXIT

View File

@ -16,7 +16,7 @@ export SYSTEMD_LOG_LEVEL=debug
if [[ ! -x "$SYSUPDATE" ]]; then if [[ ! -x "$SYSUPDATE" ]]; then
echo "no systemd-sysupdate" >/skipped echo "no systemd-sysupdate" >/skipped
exit 0 exit 77
fi fi
# Loopback devices may not be supported. They are used because sfdisk cannot # Loopback devices may not be supported. They are used because sfdisk cannot