File 0001-TEST-04-JOURNAL-adapt-for-openQA.patch of Package systemd-v245-testsuite

From 2cbe5326633efcb572a6abb7afb86847751d39cb Mon Sep 17 00:00:00 2001
From: Elisei Roca <eroca@suse.de>
Date: Fri, 8 May 2020 19:19:14 +0200
Subject: [PATCH] TEST-04-JOURNAL: adapt for openQA

---
 test/TEST-04-JOURNAL/test-journal.sh |  2 +-
 test/TEST-04-JOURNAL/test.sh         | 34 +++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
index 1431dad862..84a4f837b3 100755
--- a/test/TEST-04-JOURNAL/test-journal.sh
+++ b/test/TEST-04-JOURNAL/test-journal.sh
@@ -106,4 +106,4 @@ systemctl kill --signal=SIGKILL systemd-journald
 sleep 3
 [[ ! -f "/i-lose-my-logs" ]]
 
-touch /testok
+echo SUSEtest OK > /testok
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
index af96dfd719..07ea42d647 100755
--- a/test/TEST-04-JOURNAL/test.sh
+++ b/test/TEST-04-JOURNAL/test.sh
@@ -2,6 +2,7 @@
 set -e
 TEST_DESCRIPTION="Journal-related tests"
 
+export TEST_BASE_DIR=/var/opt/systemd-tests/test
 . $TEST_BASE_DIR/test-functions
 
 test_setup() {
@@ -33,12 +34,43 @@ Description=ForeverPrintHola service
 Type=simple
 ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
 EOF
-
+        # copy the units used by this test
         cp test-journal.sh $initdir/
+        cp test-journal.sh /
+        for service in forever-print-hola.service testsuite.service; do
+            cp $initdir/etc/systemd/system/$service /etc/systemd/system/
+        done
 
         setup_testsuite
     )
     setup_nspawn_root
 }
 
+test_run() {
+    systemctl daemon-reload
+    systemctl start testsuite.service || return 1
+    if [ -z "$TEST_NO_NSPAWN" ]; then
+        if run_nspawn "nspawn-root"; then
+            check_result_nspawn "nspawn-root" || return 1
+        else
+            dwarn "can't run systemd-nspawn, skipping"
+        fi
+    fi
+    ret=1
+    test -s /failed && ret=$(($ret+1))
+    [[ -e /testok ]] && ret=0
+    return $ret
+}
+
+test_cleanup() {
+    _test_cleanup
+    for service in forever-print-hola.service testsuite.service; do
+        rm /etc/systemd/system/$service
+    done
+    for file in $(ls /testok* /failed* /test-journal.sh 2>/dev/null); do
+      rm $file
+    done
+    return 0
+}
+
 do_test "$@"
-- 
2.26.2

openSUSE Build Service is sponsored by