From e47df8232a55b07071d85cae875699a3d0a51348 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 11 Jan 2019 10:20:30 +0100 Subject: [PATCH 1/5] test: drop service masking in TEST-01-BASIC This test should ensure all systemd starts correctly, so masking them is counter-productive in this case. --- test/TEST-01-BASIC/test.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 7aa21ff999..1c64017aaa 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -34,13 +34,6 @@ EOF ) || return 1 setup_nspawn_root - # mask some services that we do not want to run in these tests - ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ddebug "umount $TESTDIR/root" umount $TESTDIR/root } From 3071b3ff6e803d1a4f32c0a66a431e9a2ea6a1a2 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 11 Jan 2019 15:51:07 +0100 Subject: [PATCH 2/5] test: introduce QEMU_MEM Some tests (mainly under ASan/UBSan) require more than 512M of memory, so let's make it configurable (but still default to 512M). --- test/test-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 80467b526e..da3c537db0 100644 --- a/test/test-functions +++ b/test/test-functions @@ -15,6 +15,7 @@ TIMED_OUT= # will be 1 after run_* if *_TIMEOUT is set and test timed out [[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}" UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}" EFI_MOUNT="$(bootctl -p 2>/dev/null || echo /boot)" +QEMU_MEM="${QEMU_MEM:-512M}" if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2 @@ -156,7 +157,7 @@ $KERNEL_APPEND \ QEMU_OPTIONS="-smp $QEMU_SMP \ -net none \ --m 512M \ +-m $QEMU_MEM \ -nographic \ -kernel $KERNEL_BIN \ -drive format=raw,cache=unsafe,file=${TESTDIR}/rootdisk.img \ From 670bec2b072524a6ec5b84daaa64c35b97ffb211 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 11 Jan 2019 16:49:49 +0100 Subject: [PATCH 3/5] test: bump QEMU memory to 1536M when running under ASan/UBSan --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index da3c537db0..c0f6f78a7e 100644 --- a/test/test-functions +++ b/test/test-functions @@ -52,6 +52,7 @@ if [[ "$IS_BUILT_WITH_ASAN" = "yes" ]]; then STRIP_BINARIES=no SKIP_INITRD=yes PATH_TO_INIT=$ROOTLIBDIR/systemd-under-asan + QEMU_MEM="1536M" fi function find_qemu_bin() { From 5b2172ee50cc809f656556636597f861034c88b3 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 11 Jan 2019 16:51:49 +0100 Subject: [PATCH 4/5] test: bump QEMU_SMP to 4 when running under ASan/UBSan --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index c0f6f78a7e..d9ecc65661 100644 --- a/test/test-functions +++ b/test/test-functions @@ -53,6 +53,7 @@ if [[ "$IS_BUILT_WITH_ASAN" = "yes" ]]; then SKIP_INITRD=yes PATH_TO_INIT=$ROOTLIBDIR/systemd-under-asan QEMU_MEM="1536M" + QEMU_SMP=4 fi function find_qemu_bin() { From d7283fc157ceb3360b21f27eee87dd794aa50f06 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 12 Jan 2019 10:48:13 +0100 Subject: [PATCH 5/5] test: limit environments for systemd-hwdb-update under ASan --- test/test-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index d9ecc65661..498dc82b18 100644 --- a/test/test-functions +++ b/test/test-functions @@ -360,8 +360,9 @@ printf "[Service]\nEnvironment=ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/sys # 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. mkdir -p /etc/systemd/system/systemd-hwdb-update.service.d -printf "[Service]\nTimeoutSec=180s\n" >/etc/systemd/system/systemd-hwdb-update.service.d/timeout.conf +printf "[Unit]\nConditionVirtualization=container\n\n[Service]\nTimeoutSec=180s\n" >/etc/systemd/system/systemd-hwdb-update.service.d/env-override.conf export ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd.asan.log UBSAN_OPTIONS=\$DEFAULT_UBSAN_OPTIONS exec $ROOTLIBDIR/systemd "\$@"