chiark / gitweb /
test: test irreversible jobs
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 22 Feb 2013 17:59:07 +0000 (18:59 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Sat, 23 Feb 2013 13:18:17 +0000 (14:18 +0100)
test/TEST-03-JOBS/test-jobs.sh
test/TEST-03-JOBS/test.sh
test/unstoppable.service [new file with mode: 0644]

index 98746c53636b93f185996688ed4a9e4932f42ed7..12b38af94204ba6113e30b18746b2069e5e8a892 100755 (executable)
@@ -24,5 +24,18 @@ grep 'hello\.service' /root/list-jobs.txt && exit 1
 
 # TODO: add more job queueing/merging tests here.
 
+# Test for irreversible jobs
+systemctl start unstoppable.service || exit 1
+
+# This is expected to fail with 'job cancelled'
+systemctl stop unstoppable.service && exit 1
+# But this should succeed
+systemctl stop --irreversible unstoppable.service || exit 1
+
+# We're going to shutdown soon. Let's see if it succeeds when
+# there's an active service that tries to be unstoppable.
+# Shutdown of the container/VM will hang if not.
+systemctl start unstoppable.service || exit 1
+
 touch /testok
 exit 0
index bd211f3ad5d5d5318842d41db8ec51313f5aec09..6eaba72e576a53c56915705cf41057351bea2734 100755 (executable)
@@ -1,7 +1,7 @@
 #!/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)
@@ -138,7 +138,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
diff --git a/test/unstoppable.service b/test/unstoppable.service
new file mode 100644 (file)
index 0000000..24fb0a2
--- /dev/null
@@ -0,0 +1,5 @@
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/echo 'I'm unstoppable!'
+ExecStop=/bin/systemctl start --no-block unstoppable.service