]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix ASAN options in TEST-29-PORTABLE
authorLuca Boccassi <bluca@debian.org>
Sun, 15 Sep 2024 14:19:57 +0000 (16:19 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 15 Sep 2024 16:10:29 +0000 (18:10 +0200)
Bash arrays cannot be exported, so we need to redefine it in each
subtest

Follow-up for 680dec33f27d408c94afe654113ba87e3bb8208b

test/units/TEST-29-PORTABLE.directory.sh
test/units/TEST-29-PORTABLE.image.sh
test/units/TEST-29-PORTABLE.sh

index d541ad77b0329877fdc2c5ab544356371fd2ce5c..5458111ee201d8d2a97c8d4b15ef330f31a540b5 100755 (executable)
@@ -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
 
index 4be0170bc40c5c1d6d6ad161282e396945bb7517..376d94c28331a30bad8ddad06fd67cab2c18d443 100755 (executable)
@@ -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
index 23cfa51ef02b62f028a77c39729905aee60cc7d5..7e0ba7e38a68a7758f5cff1a81b3b462a7450cf3 100755 (executable)
@@ -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