summaryrefslogtreecommitdiffstats
path: root/test/test-functions
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2022-10-02 22:51:56 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2022-10-02 22:53:26 +0200
commit326425fb4dfd20c8410be46b6c2c0ea865436de8 (patch)
treee97f460ed8905c1a382e0227bcf2b743944c1413 /test/test-functions
parenttest: introduce a simple environment file for test service (diff)
downloadsystemd-326425fb4dfd20c8410be46b6c2c0ea865436de8.tar.xz
systemd-326425fb4dfd20c8410be46b6c2c0ea865436de8.zip
test: pre-load ASan's DSO for iscsi-init.service
The iscsi-init.service calls `sh` which might, in certain circumstances, pull in instrumented systemd NSS modules causing `sh` to fail. Let's mitigate this by pulling in an env file crafted by `create_asan_wrapper()` that (among others) pre-loads ASan's DSO.
Diffstat (limited to 'test/test-functions')
-rw-r--r--test/test-functions8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test-functions b/test/test-functions
index 06652cfad6..d1e3e993f9 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -1047,6 +1047,14 @@ install_iscsi() {
# [0] https://github.com/open-iscsi/open-iscsi/commit/f37d5b653f9f251845db3f29b1a3dcb90ec89731
if [[ ! -e /etc/iscsi/initiatorname.iscsi ]]; then
image_install "${ROOTLIBDIR:?}"/system/iscsi-init.service
+ if get_bool "$IS_BUILT_WITH_ASAN"; then
+ # The iscsi-init.service calls `sh` which might, in certain circumstances,
+ # pull in instrumented systemd NSS modules causing `sh` to fail. Let's mitigate
+ # this by pulling in an env file crafted by `create_asan_wrapper()` that
+ # (among others) pre-loads ASan's DSO.
+ mkdir -p "${initdir:?}/etc/systemd/system/iscsi-init.service.d/"
+ printf "[Service]\nEnvironmentFile=/usr/lib/systemd/systemd-asan-env" >"${initdir:?}/etc/systemd/system/iscsi-init.service.d/asan-env.conf"
+ fi
else
inst_simple "/etc/iscsi/initiatorname.iscsi"
fi