From 6141c6c99bbcba92b748a3a826257bea5ef28731 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 10 May 2019 02:47:03 +0200 Subject: [PATCH] tests: redirect the stdout/stderr of journald to a file (under ASan+UBSan) 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 780cbd04191..f8dc44a6ef3 100644 --- a/test/test-functions +++ b/test/test-functions @@ -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 -- 2.47.3