From 02baf239d87295362740d961765091b778795573 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 3 Oct 2019 19:05:06 +0200 Subject: [PATCH] add test for ExecStopPost This is a follow-up to #4843. --- test/TEST-42-EXECSTOPPOST/Makefile | 9 +++ test/TEST-42-EXECSTOPPOST/test.sh | 47 ++++++++++++++ test/TEST-42-EXECSTOPPOST/testsuite.sh | 89 ++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 test/TEST-42-EXECSTOPPOST/Makefile create mode 100755 test/TEST-42-EXECSTOPPOST/test.sh create mode 100755 test/TEST-42-EXECSTOPPOST/testsuite.sh diff --git a/test/TEST-42-EXECSTOPPOST/Makefile b/test/TEST-42-EXECSTOPPOST/Makefile new file mode 100644 index 0000000000..45e9bfc67c --- /dev/null +++ b/test/TEST-42-EXECSTOPPOST/Makefile @@ -0,0 +1,9 @@ +BUILD_DIR=$(shell ../../tools/find-build-dir.sh) + +all setup run: + @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@ + +clean clean-again: + @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --clean + +.PHONY: all setup run clean clean-again diff --git a/test/TEST-42-EXECSTOPPOST/test.sh b/test/TEST-42-EXECSTOPPOST/test.sh new file mode 100755 index 0000000000..dd967879ca --- /dev/null +++ b/test/TEST-42-EXECSTOPPOST/test.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e +TEST_DESCRIPTION="test that ExecStopPost= is always run" + +. $TEST_BASE_DIR/test-functions + +test_setup() { + create_empty_image_rootdir + + ( + LOG_LEVEL=5 + eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) + + setup_basic_environment + + mask_supporting_services + + # setup policy for Type=dbus test + mkdir -p $initdir/etc/dbus-1/system.d + cat > $initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf < + + + + + + +EOF + + # setup the testsuite service + cat >$initdir/etc/systemd/system/testsuite.service < /tmp/forking1.sh < /tmp/forking2.sh < /tmp/notify1.sh < /testok + +exit 0