From: Luca Boccassi Date: Sun, 15 Sep 2024 14:19:57 +0000 (+0200) Subject: test: fix ASAN options in TEST-29-PORTABLE X-Git-Tag: v257-rc1~438 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37c2010bcf5224e77d6d379e25b2c172fcef1257;p=thirdparty%2Fsystemd.git test: fix ASAN options in TEST-29-PORTABLE Bash arrays cannot be exported, so we need to redefine it in each subtest Follow-up for 680dec33f27d408c94afe654113ba87e3bb8208b --- diff --git a/test/units/TEST-29-PORTABLE.directory.sh b/test/units/TEST-29-PORTABLE.directory.sh index d541ad77b03..5458111ee20 100755 --- a/test/units/TEST-29-PORTABLE.directory.sh +++ b/test/units/TEST-29-PORTABLE.directory.sh @@ -9,6 +9,14 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +# Arrays cannot be exported, so redefine in each test script +ARGS=() +if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then + # If we're running under sanitizers, we need to use a less restrictive + # profile, otherwise LSan syscall would get blocked by seccomp + ARGS+=(--profile=trusted) +fi + unsquashfs -dest /tmp/minimal_0 /usr/share/minimal_0.raw unsquashfs -dest /tmp/minimal_1 /usr/share/minimal_1.raw diff --git a/test/units/TEST-29-PORTABLE.image.sh b/test/units/TEST-29-PORTABLE.image.sh index 4be0170bc40..376d94c2833 100755 --- a/test/units/TEST-29-PORTABLE.image.sh +++ b/test/units/TEST-29-PORTABLE.image.sh @@ -9,6 +9,14 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +# Arrays cannot be exported, so redefine in each test script +ARGS=() +if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then + # If we're running under sanitizers, we need to use a less restrictive + # profile, otherwise LSan syscall would get blocked by seccomp + ARGS+=(--profile=trusted) +fi + portablectl "${ARGS[@]}" attach --now --runtime /usr/share/minimal_0.raw minimal-app0 portablectl is-attached minimal-app0 diff --git a/test/units/TEST-29-PORTABLE.sh b/test/units/TEST-29-PORTABLE.sh index 23cfa51ef02..7e0ba7e38a6 100755 --- a/test/units/TEST-29-PORTABLE.sh +++ b/test/units/TEST-29-PORTABLE.sh @@ -29,7 +29,6 @@ EOF systemctl daemon-reexec -export SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30 udevadm control --log-level debug @@ -42,9 +41,9 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then # With the trusted profile DynamicUser is disabled, so the storage is not in private/ STATE_DIRECTORY=/var/lib/ fi -export ARGS export STATE_DIRECTORY export SYSTEMD_LOG_LEVEL=debug +export SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30 # Quick smoke tests