chiark / gitweb /
hwdb: update
[elogind.git] / test / TEST-03-JOBS / test.sh
index bd211f3ad5d5d5318842d41db8ec51313f5aec09..02fd8b9ce86d22332e537b9ab0b240ec99bc883e 100755 (executable)
@@ -1,10 +1,9 @@
 #!/bin/bash
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
-TEST_DESCRIPTION="Job merging"
+TEST_DESCRIPTION="Job-related tests"
 
-KVERSION=${KVERSION-$(uname -r)}
-KERNEL_VER=$(uname -r)
+. $TEST_BASE_DIR/test-functions
 
 # Uncomment this to debug failures
 #DEBUGFAIL="systemd.unit=multi-user.target"
@@ -22,10 +21,10 @@ run_qemu() {
     mkdir -p $TESTDIR/root
     mount ${LOOPDEV}p1 $TESTDIR/root
     [[ -e $TESTDIR/root/testok ]] && ret=0
-    cp -a $TESTDIR/root/failed $TESTDIR
+    [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/root/failed $TESTDIR
     cp -a $TESTDIR/root/var/log/journal $TESTDIR
     umount $TESTDIR/root
-    cat $TESTDIR/failed
+    [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
     ls -l $TESTDIR/journal/*/*.journal
     test -s $TESTDIR/failed && ret=$(($ret+1))
     return $ret
@@ -36,9 +35,9 @@ run_nspawn() {
     ../../systemd-nspawn -b -D $TESTDIR/nspawn-root /usr/lib/systemd/systemd
     ret=1
     [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
-    cp -a $TESTDIR/nspawn-root/failed $TESTDIR
+    [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/nspawn-root/failed $TESTDIR
     cp -a $TESTDIR/nspawn-root/var/log/journal $TESTDIR
-    cat $TESTDIR/failed
+    [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
     ls -l $TESTDIR/journal/*/*.journal
     test -s $TESTDIR/failed && ret=$(($ret+1))
     return $ret
@@ -138,7 +137,8 @@ Type=oneshot
 EOF
 
         # copy the units used by this test
-        cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target} $initdir/etc/systemd/system
+        cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target,unstoppable.service} \
+            $initdir/etc/systemd/system
         cp test-jobs.sh $initdir/
 
         mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
@@ -246,5 +246,4 @@ test_cleanup() {
     return 0
 }
 
-. $TEST_BASE_DIR/test-functions
 do_test "$@"