From: Frantisek Sumsal Date: Wed, 29 Nov 2023 12:36:54 +0000 (+0100) Subject: test: ignore gcov errors with RestrictFileSystems= X-Git-Tag: v255-rc4~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee77e0b2de7cf828e0a11c907e8345612da094e5;p=thirdparty%2Fsystemd.git test: ignore gcov errors with RestrictFileSystems= The errors are valid, since the file system is indeed not writable, but we don't care about the missing coverage data in this case. Follow-up to 4a43c2b3a1. --- diff --git a/test/units/testsuite-07.exec-context.sh b/test/units/testsuite-07.exec-context.sh index 10b425359d4..348c164b86f 100755 --- a/test/units/testsuite-07.exec-context.sh +++ b/test/units/testsuite-07.exec-context.sh @@ -291,12 +291,15 @@ systemd-run --wait --pipe "${ARGUMENTS[@]}" \ # # Note: running instrumented binaries requires at least /proc to be accessible, so let's # skip the test when we're running under sanitizers +# +# Note: $GCOV_ERROR_LOG is used during coverage runs to suppress errors when creating *.gcda files, +# since gcov can't access the restricted filesystem (as expected) if [[ ! -v ASAN_OPTIONS ]] && systemctl --version | grep "+BPF_FRAMEWORK" && kernel_supports_lsm bpf; then ROOTFS="$(df --output=fstype /usr/bin | sed --quiet 2p)" systemd-run --wait --pipe -p RestrictFileSystems="" ls / systemd-run --wait --pipe -p RestrictFileSystems="$ROOTFS foo bar" ls / (! systemd-run --wait --pipe -p RestrictFileSystems="$ROOTFS" ls /proc) - (! systemd-run --wait --pipe -p RestrictFileSystems="foo" ls /) + (! systemd-run --wait --pipe -p GCOV_ERROR_LOG=/dev/null -p RestrictFileSystems="foo" ls /) systemd-run --wait --pipe -p RestrictFileSystems="$ROOTFS foo bar baz proc" ls /proc systemd-run --wait --pipe -p RestrictFileSystems="$ROOTFS @foo @basic-api" ls /proc systemd-run --wait --pipe -p RestrictFileSystems="$ROOTFS @foo @basic-api" ls /sys/fs/cgroup @@ -304,7 +307,7 @@ if [[ ! -v ASAN_OPTIONS ]] && systemctl --version | grep "+BPF_FRAMEWORK" && ker systemd-run --wait --pipe -p RestrictFileSystems="~" ls / systemd-run --wait --pipe -p RestrictFileSystems="~proc" ls / systemd-run --wait --pipe -p RestrictFileSystems="~@basic-api" ls / - (! systemd-run --wait --pipe -p RestrictFileSystems="~$ROOTFS" ls /) + (! systemd-run --wait --pipe -p GCOV_ERROR_LOG=/dev/null -p RestrictFileSystems="~$ROOTFS" ls /) (! systemd-run --wait --pipe -p RestrictFileSystems="~proc" ls /proc) (! systemd-run --wait --pipe -p RestrictFileSystems="~@basic-api" ls /proc) (! systemd-run --wait --pipe -p RestrictFileSystems="~proc foo @bar @basic-api" ls /proc)