valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0102-tests-use-the-asan-wrapper-to-boot-a-VM-container-if.patch

4bff0a
From 26b213f1dc3d869bc8b22607b2e1b5f27717ddc1 Mon Sep 17 00:00:00 2001
4bff0a
From: Evgeny Vereshchagin <evvers@ya.ru>
4bff0a
Date: Thu, 5 Jul 2018 15:14:07 +0000
4bff0a
Subject: [PATCH] tests: use the asan wrapper to boot a VM/container if systemd
4bff0a
 is built with ASAN
4bff0a
4bff0a
(cherry picked from commit 016fa3b9e8c3550d49f659c49b5ff4d93337aefe)
4bff0a
---
4bff0a
 test/test-functions | 8 ++++++--
4bff0a
 1 file changed, 6 insertions(+), 2 deletions(-)
4bff0a
4bff0a
diff --git a/test/test-functions b/test/test-functions
4bff0a
index 822136913b..76eef8aa4d 100644
4bff0a
--- a/test/test-functions
4bff0a
+++ b/test/test-functions
4bff0a
@@ -21,6 +21,8 @@ if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
4bff0a
     ROOTLIBDIR=/usr/lib/systemd
4bff0a
 fi
4bff0a
 
4bff0a
+PATH_TO_INIT=$ROOTLIBDIR/systemd
4bff0a
+
4bff0a
 BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs"
4bff0a
 DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find"
4bff0a
 
4bff0a
@@ -47,6 +49,8 @@ IS_BUILT_WITH_ASAN=$(is_built_with_asan && echo yes || echo no)
4bff0a
 
4bff0a
 if [[ "$IS_BUILT_WITH_ASAN" = "yes" ]]; then
4bff0a
     STRIP_BINARIES=no
4bff0a
+    SKIP_INITRD=yes
4bff0a
+    PATH_TO_INIT=$ROOTLIBDIR/systemd-under-asan
4bff0a
 fi
4bff0a
 
4bff0a
 function find_qemu_bin() {
4bff0a
@@ -142,7 +146,7 @@ KERNEL_APPEND="$PARAMS \
4bff0a
 root=/dev/sda1 \
4bff0a
 raid=noautodetect \
4bff0a
 loglevel=2 \
4bff0a
-init=$ROOTLIBDIR/systemd \
4bff0a
+init=$PATH_TO_INIT \
4bff0a
 console=ttyS0 \
4bff0a
 selinux=0 \
4bff0a
 printk.devkmsg=on \
4bff0a
@@ -186,7 +190,7 @@ $KERNEL_APPEND \
4bff0a
 run_nspawn() {
4bff0a
     [[ -d /run/systemd/system ]] || return 1
4bff0a
 
4bff0a
-    local _nspawn_cmd="$BUILD_DIR/systemd-nspawn --register=no --kill-signal=SIGKILL --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND"
4bff0a
+    local _nspawn_cmd="$BUILD_DIR/systemd-nspawn --register=no --kill-signal=SIGKILL --directory=$TESTDIR/nspawn-root $PATH_TO_INIT $KERNEL_APPEND"
4bff0a
     if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then
4bff0a
         _nspawn_cmd="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd"
4bff0a
     fi