File 0014-TEST-05-RLIMITS-remove-qemu-from-testrun.patch of Package systemd-v234-testsuite

From 638fd54bbc11e744a2f745b403107774e6f6e7d9 Mon Sep 17 00:00:00 2001
From: Thomas Blume <thomas.blume@suse.com>
Date: Thu, 7 Mar 2019 12:43:06 +0100
Subject: [PATCH 05/10] TEST-05-RLIMITS: remove qemu from testrun

---
 test/TEST-05-RLIMITS/test.sh | 45 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh
index a1b855c5fb..b7e96ad7be 100755
--- a/test/TEST-05-RLIMITS/test.sh
+++ b/test/TEST-05-RLIMITS/test.sh
@@ -4,20 +4,38 @@
 set -e
 TEST_DESCRIPTION="Resource limits-related tests"
 
+export TEST_BASE_DIR=/var/opt/systemd-tests/test
 . $TEST_BASE_DIR/test-functions
 
+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
     mkdir -p $TESTDIR/root
-    mount ${LOOPDEV}p1 $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
 
+        #set test limit
         cat >$initdir/etc/systemd/system.conf <<EOF
 [Manager]
 DefaultLimitNOFILE=10000:16384
@@ -30,18 +48,33 @@ Description=Testsuite service
 After=multi-user.target
 
 [Service]
-ExecStart=/test-rlimits.sh
+ExecStart=$TESTDIR/nspawn-root/test-rlimits.sh
+ExecStartPost=/bin/sh -x -c 'echo -e "\nfailed:" > /failed; systemctl --state=failed --no-pager >> /failed; echo -e "\ntestresult:\nOK" > /testok'
 Type=oneshot
 EOF
 
+        # copy the units used by this test
+        cp $initdir/etc/systemd/system/testsuite.service /etc/systemd/system/testsuite.service
+	mv /etc/systemd/system.conf /etc/systemd/system.conf.orig
+	cp $initdir/etc/systemd/system.conf /etc/systemd/
         cp test-rlimits.sh $initdir/
 
         setup_testsuite
     ) || return 1
+
     setup_nspawn_root
+    rm -r $TESTDIR/root
+}
+
+test_cleanup() {
+    for service in testsuite.service; do
+         rm /etc/systemd/system/$service
+    done
+    mv /etc/systemd/system.conf.orig /etc/systemd/system.conf
+    [[ -e /testok ]] && rm /testok
+    [[ -e /failed ]] && rm /failed
+    return 0
 
-    ddebug "umount $TESTDIR/root"
-    umount $TESTDIR/root
 }
 
 do_test "$@"
-- 
2.16.4

openSUSE Build Service is sponsored by