4bff0a
From d0d284178c1ceb2bd13c9b501008c4458a58fe37 Mon Sep 17 00:00:00 2001
4bff0a
From: Evgeny Vereshchagin <evvers@ya.ru>
4bff0a
Date: Tue, 3 Jul 2018 19:29:42 +0000
4bff0a
Subject: [PATCH] tests: redirect ASAN reports on journald to a file
4bff0a
4bff0a
Otherwise, they will end up in /dev/null.
4bff0a
4bff0a
(cherry picked from commit 88ed0f261ba8164a689395ddee8b92d00e073515)
4bff0a
---
4bff0a
 test/test-functions | 6 ++++++
4bff0a
 1 file changed, 6 insertions(+)
4bff0a
4bff0a
diff --git a/test/test-functions b/test/test-functions
4bff0a
index a6f88e4545..822136913b 100644
4bff0a
--- a/test/test-functions
4bff0a
+++ b/test/test-functions
4bff0a
@@ -343,6 +343,12 @@ echo DefaultEnvironment=\$DEFAULT_ENVIRONMENT >>/etc/systemd/system.conf
4bff0a
 # ASAN and syscall filters aren't compatible with each other.
4bff0a
 find / -name '*.service' -type f | xargs sed -i 's/^\\(MemoryDeny\\|SystemCall\\)/#\\1/'
4bff0a
 
4bff0a
+# The redirection of ASAN reports to a file prevents them from ending up in /dev/null.
4bff0a
+# But, apparently, sometimes it doesn't work: https://github.com/google/sanitizers/issues/886.
4bff0a
+JOURNALD_CONF_DIR=/etc/systemd/system/systemd-journald.service.d
4bff0a
+mkdir -p "\$JOURNALD_CONF_DIR"
4bff0a
+printf "[Service]\nEnvironment=ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd-journald.asan.log\n" >"\$JOURNALD_CONF_DIR/env.conf"
4bff0a
+
4bff0a
 export ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd.asan.log
4bff0a
 exec  $ROOTLIBDIR/systemd "\$@"
4bff0a
 EOF