diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-03-09 22:20:39 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-03-10 11:59:43 +0100 |
commit | 4b252eaa316ae811f6523cde0028fc53ba29e6cf (patch) | |
tree | 37bbc3c4c1b465a7a2abd4d7cef812863a5994fd /test/TEST-22-TMPFILES | |
parent | Merge pull request #18553 from Werkov/cgroup-user-instance-controllers (diff) | |
download | systemd-4b252eaa316ae811f6523cde0028fc53ba29e6cf.tar.xz systemd-4b252eaa316ae811f6523cde0028fc53ba29e6cf.zip |
test: disable nss-systemd for TEST-22 under ASan
When running TEST-22 under ASan, there's a chain of events which causes
`stat` to output an extraneous ASan error message, causing following
fail:
```
+ test -d /tmp/d/1
++ stat -c %U:%G:%a /tmp/d/1
==82==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
+ test = daemon:daemon:755
.//usr/lib/systemd/tests/testdata/units/testsuite-22.02.sh: line 24: test: =: unary operator expected
```
This is caused by `stat` calling nss which in Arch's configuration calls
the nss-systemd module, that pulls in libasan which causes the $LD_PRELOAD
error message, since `stat` is an uninstrumented binary.
The $LD_PRELOAD variable is explicitly unset for all testsuite-* services
since it causes various issues when calling uninstrumented libraries, so
setting it globally is not an option. Another option would be to set
$LD_PRELOAD for each `stat` call, but that would unnecessarily clutter
the test code.
Diffstat (limited to 'test/TEST-22-TMPFILES')
-rwxr-xr-x | test/TEST-22-TMPFILES/test.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/TEST-22-TMPFILES/test.sh b/test/TEST-22-TMPFILES/test.sh index 317e4a88f7..e4874b4d23 100755 --- a/test/TEST-22-TMPFILES/test.sh +++ b/test/TEST-22-TMPFILES/test.sh @@ -4,4 +4,15 @@ TEST_DESCRIPTION="Tmpfiles related tests" TEST_NO_QEMU=1 . $TEST_BASE_DIR/test-functions +test_append_files() { + if [[ "$IS_BUILT_WITH_ASAN" == "yes" ]]; then + if [[ -z "$initdir" ]]; then + echo >&2 "\$initdir is not defined, can't continue" + exit 1 + fi + + sed -i "s/systemd//g" "$initdir/etc/nsswitch.conf" + fi +} + do_test "$@" 22 |