]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: redirect the stdout/stderr of journald to a file (under ASan+UBSan)
authorEvgeny Vereshchagin <evvers@ya.ru>
Fri, 10 May 2019 00:47:03 +0000 (02:47 +0200)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sun, 12 May 2019 01:37:36 +0000 (03:37 +0200)
Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See https://github.com/systemd/systemd/pull/12524#issuecomment-491108821

test/test-functions

index 780cbd04191ec61df8f800d0eecd432cc8125d38..f8dc44a6ef3f4f075803e92cbf8c6c4ff858e72c 100644 (file)
@@ -380,6 +380,11 @@ JOURNALD_CONF_DIR=/etc/systemd/system/systemd-journald.service.d
 mkdir -p "\$JOURNALD_CONF_DIR"
 printf "[Service]\nEnvironment=ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd-journald.asan.log UBSAN_OPTIONS=\$DEFAULT_UBSAN_OPTIONS:log_path=/systemd-journald.ubsan.log\n" >"\$JOURNALD_CONF_DIR/env.conf"
 
+# Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
+# Let's try to catch them by redirecting stderr (and stdout just in case) to a file
+# See https://github.com/systemd/systemd/pull/12524#issuecomment-491108821
+printf "[Service]\nStandardOutput=file:/systemd-journald.out\n" >"\$JOURNALD_CONF_DIR/out.conf"
+
 # 90s isn't enough for some services to finish when literally everything is run
 # under ASan+UBSan in containers, which, in turn, are run in VMs.
 # Let's limit which environments such services should be executed in.
@@ -510,7 +515,8 @@ check_asan_reports() {
 
         journald_report=$(find "$root" -name "systemd-journald.*san.log*" -exec cat {} \;)
         if [[ ! -z "$journald_report" ]]; then
-            printf "%s" "$journald_report"
+            printf "%s\n" "$journald_report"
+            cat "$root/systemd-journald.out" || true
             ret=$(($ret+1))
         fi