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