File 0009-TEST-08-ISSUE-2730-adapt-for-SUSE-openQA.patch of Package systemd-v244-testsuite

From c9802c92a29006ae0684867f285cf78ea14f139e Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Thu, 19 Dec 2019 08:50:44 +0100
Subject: [PATCH] TEST-08-ISSUE-2730: adapt for SUSE openQA

---
 test/TEST-08-ISSUE-2730/test.sh | 45 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh
index a9e6ffa79d..bb8770a6e7 100755
--- a/test/TEST-08-ISSUE-2730/test.sh
+++ b/test/TEST-08-ISSUE-2730/test.sh
@@ -3,17 +3,35 @@ set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730"
 TEST_NO_NSPAWN=1
 
+export TEST_BASE_DIR=/var/opt/systemd-tests/test
 . $TEST_BASE_DIR/test-functions
-QEMU_TIMEOUT=180
-FSTYPE=ext4
+FSTYPE=btrfs
+
+test_run() {
+    ret=1
+    systemctl daemon-reload
+    systemctl start testsuite.service || return 1
+    systemctl status --full testsuite.service
+    if [ -z "$TEST_NO_NSPAWN" ]; then
+        if run_nspawn; then
+            check_result_nspawn || return 1
+        else
+            dwarn "can't run systemd-nspawn, skipping"
+        fi
+    fi
+    test -s /failed && ret=$(($ret+1))
+    [[ -e /testok ]] && ret=0
+    return $ret
+}
 
 test_setup() {
-    create_empty_image_rootdir
+    mkdir -p $TESTDIR/root
+    initdir=$TESTDIR/root
+    STRIP_BINARIES=no
 
     # Create what will eventually be our root filesystem onto an overlay
     (
         LOG_LEVEL=5
-        eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
 
         setup_basic_environment
 
@@ -23,7 +41,8 @@ test_setup() {
 Description=Testsuite service
 
 [Service]
-ExecStart=/bin/sh -x -c 'mount -o remount,rw /dev/sda1 && echo OK > /testok; systemctl poweroff'
+ExecStart=/bin/sh -x -c 'mount -o remount,rw /dev/vda2 && echo SUSEtest OK > /testok'
+ExecStartPost=/bin/sh -x -c 'systemctl --state=failed --no-pager > /failed'
 Type=oneshot
 EOF
 
@@ -33,7 +52,7 @@ EOF
 Before=local-fs.target
 
 [Mount]
-What=/dev/sda1
+What=/dev/vda2
 Where=/
 Type=ext4
 Options=errors=remount-ro,noatime
@@ -57,9 +76,11 @@ RemainAfterExit=yes
 ExecStart=/bin/systemctl reload /
 EOF
 
-        setup_testsuite
     )
 
+    # copy the units used by this test
+    cp $initdir/etc/systemd/system/testsuite.service /etc/systemd/system/testsuite.service
+
     ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/root.mount
     mkdir -p $initdir/etc/systemd/system/local-fs.target.wants
     ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/local-fs.target.wants/-.mount
@@ -67,4 +88,14 @@ EOF
     mask_supporting_services
 }
 
+test_cleanup() {
+    for service in testsuite.service; do
+         rm /etc/systemd/system/$service
+    done
+    [[ -e /testok ]] && rm /testok
+    [[ -e /failed ]] && rm /failed
+    return 0
+
+}
+
 do_test "$@"
-- 
2.16.4

openSUSE Build Service is sponsored by