From abf9b52ccda512ce09e6cf1219ecf3252a5e24c2 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 10 May 2019 01:00:29 +0200 Subject: [PATCH 1/5] tests: redirect UBsan reports to a file so that they won't end up in /dev/null --- test/test-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-functions b/test/test-functions index bfd6b6662a..780cbd0419 100644 --- a/test/test-functions +++ b/test/test-functions @@ -378,7 +378,7 @@ find / -name '*.service' -type f | xargs sed -i 's/^\\(MemoryDeny\\|SystemCall\\ # But, apparently, sometimes it doesn't work: https://github.com/google/sanitizers/issues/886. 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\n" >"\$JOURNALD_CONF_DIR/env.conf" +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" # 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. @@ -508,7 +508,7 @@ check_asan_reports() { ret=$(($ret+1)) fi - journald_report=$(find "$root" -name "systemd-journald.asan.log*" -exec cat {} \;) + journald_report=$(find "$root" -name "systemd-journald.*san.log*" -exec cat {} \;) if [[ ! -z "$journald_report" ]]; then printf "%s" "$journald_report" ret=$(($ret+1)) From 6141c6c99bbcba92b748a3a826257bea5ef28731 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 10 May 2019 02:47:03 +0200 Subject: [PATCH 2/5] 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 780cbd0419..f8dc44a6ef 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 From a5372344eadaa44be3aeb68564b95f791cf11010 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 10 May 2019 18:33:35 +0200 Subject: [PATCH 3/5] tests: override a hard-coded timeout that kicks in too early (under ASan+UBSan) The test has failed two times today: https://travis-ci.org/systemd/systemd/jobs/530750626 and https://travis-ci.org/systemd/systemd/jobs/530759465. --- test/test-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test-functions b/test/test-functions index f8dc44a6ef..30b559097b 100644 --- a/test/test-functions +++ b/test/test-functions @@ -391,6 +391,10 @@ printf "[Service]\nStandardOutput=file:/systemd-journald.out\n" >"\$JOURNALD_CON mkdir -p /etc/systemd/system/systemd-hwdb-update.service.d printf "[Unit]\nConditionVirtualization=container\n\n[Service]\nTimeoutSec=180s\n" >/etc/systemd/system/systemd-hwdb-update.service.d/env-override.conf +# Let's override another hard-coded timeout that kicks in too early +mkdir -p /etc/systemd/system/systemd-journal-flush.service.d +printf "[Service]\nTimeoutSec=180s\n" >/etc/systemd/system/systemd-journal-flush.service.d/timeout.conf + # The 'mount' utility doesn't behave well under libasan, causing unexpected # fails during boot and subsequent test results check: # bash-5.0# mount -o remount,rw -v / From 8a243a04d79cc2195f50ca778f3a0f1a75e56b52 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sun, 12 May 2019 03:45:29 +0200 Subject: [PATCH 4/5] travis: make the ASan+UBSan stage compatible with Azure Pipelines --- travis-ci/managers/xenial.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/travis-ci/managers/xenial.sh b/travis-ci/managers/xenial.sh index 4822bdd4b7..e1c5d77cbf 100755 --- a/travis-ci/managers/xenial.sh +++ b/travis-ci/managers/xenial.sh @@ -2,13 +2,14 @@ set -e set -x +bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list" apt-get update apt-get build-dep systemd -y apt-get install -y util-linux libmount-dev libblkid-dev liblzma-dev libqrencode-dev libmicrohttpd-dev iptables-dev liblz4-dev libcurl4-gnutls-dev unifont itstool kbd cryptsetup-bin net-tools isc-dhcp-client iputils-ping strace qemu-system-x86 linux-image-virtual mount libgpg-error-dev libxkbcommon-dev python-lxml python3-lxml python3-pip libcap-dev apt-get install -y gettext python3-evdev python3-pyparsing libmount-dev python3-setuptools ninja-build pip3 install meson -cd $REPO_ROOT +cd ${REPO_ROOT:-$(pwd)} sed -i 's/2\.30/2.27/' meson.build From 52899bebc4f4a52c2e966e288fc1040aaf966375 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sun, 12 May 2019 04:04:29 +0200 Subject: [PATCH 5/5] tests: hook up the repository to Azure Pipelines The idea is to move a couple of stages from Travis CI (which has been overloaded since I added the "FuzzBuzz" stage) to Azure Pipelines. --- azure-pipelines.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..961b7920d6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,11 @@ +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- script: | + set -e + sudo ./travis-ci/managers/xenial.sh + displayName: 'This is where it gets darker'