summaryrefslogtreecommitdiffstats
path: root/tests/test7.tst
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test7.tst')
-rw-r--r--tests/test7.tst27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test7.tst b/tests/test7.tst
new file mode 100644
index 0000000..7dab5fc
--- /dev/null
+++ b/tests/test7.tst
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+source ${CURDIR}/tests/functions
+
+#
+# Test orphanskill feature (explicit)
+#
+header "Test orphanskill feature (explicit)"
+runcmd "$MOCKCMD --offline --init"
+runcmd "$MOCKCMD --offline --copyin tests/daemontest.c /tmp"
+runcmd "$MOCKCMD --offline --chroot -- gcc -Wall -o /tmp/daemontest /tmp/daemontest.c"
+echo -e "#!/bin/sh\n/tmp/daemontest\nsleep 60\n" >> $CHROOT/tmp/try
+# the following should launch about three processes in the chroot: bash, sleep, daemontest
+$MOCKCMD --offline --chroot -- bash /tmp/try &
+mockpid=$!
+sleep 1
+# now we 'prematurely' kill mock. This should leave the three orphans above
+sudo kill -9 $mockpid
+if ! pgrep daemontest; then
+ echo "Daemontest failed. daemontest should be running now but is not."
+ exit 1
+fi
+$MOCKCMD --offline --orphanskill
+if pgrep daemontest; then
+ echo "Daemontest FAILED. found a daemontest process running after exit."
+ exit 1
+fi