From bdfa9657d0aaba7d23757f690265b1665f9ff9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 20 Mar 2020 19:57:54 +0100 Subject: [PATCH] test: move TEST-47-* to static files --- test/TEST-47-ISSUE-14566/test.sh | 41 +------------------ test/units/testsuite-47-repro.service | 7 ++++ .../repro.sh => units/testsuite-47-repro.sh} | 2 +- test/units/testsuite-47.service | 6 +++ .../testsuite.sh => units/testsuite-47.sh} | 8 ++-- 5 files changed, 20 insertions(+), 44 deletions(-) create mode 100644 test/units/testsuite-47-repro.service rename test/{TEST-47-ISSUE-14566/repro.sh => units/testsuite-47-repro.sh} (71%) create mode 100644 test/units/testsuite-47.service rename test/{TEST-47-ISSUE-14566/testsuite.sh => units/testsuite-47.sh} (71%) diff --git a/test/TEST-47-ISSUE-14566/test.sh b/test/TEST-47-ISSUE-14566/test.sh index 35f862331c..11ae3d2524 100755 --- a/test/TEST-47-ISSUE-14566/test.sh +++ b/test/TEST-47-ISSUE-14566/test.sh @@ -1,43 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash set -e TEST_DESCRIPTION="Test that KillMode=mixed does not leave left over proccesses with ExecStopPost=" . $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 the testsuite service - cat >$initdir/etc/systemd/system/testsuite.service < $initdir/etc/systemd/system/issue_14566_test.service << EOF -[Unit] -Description=Issue 14566 Repro - -[Service] -ExecStart=/repro.sh -ExecStopPost=/bin/true -KillMode=mixed -EOF - - cp testsuite.sh $initdir/ - cp repro.sh $initdir/ - - setup_testsuite - ) - setup_nspawn_root -} - -do_test "$@" +do_test "$@" 47 diff --git a/test/units/testsuite-47-repro.service b/test/units/testsuite-47-repro.service new file mode 100644 index 0000000000..655eea68e5 --- /dev/null +++ b/test/units/testsuite-47-repro.service @@ -0,0 +1,7 @@ +[Unit] +Description=Issue 14566 Repro + +[Service] +ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +ExecStopPost=/bin/true +KillMode=mixed diff --git a/test/TEST-47-ISSUE-14566/repro.sh b/test/units/testsuite-47-repro.sh similarity index 71% rename from test/TEST-47-ISSUE-14566/repro.sh rename to test/units/testsuite-47-repro.sh index 5217602257..8c34289c52 100755 --- a/test/TEST-47-ISSUE-14566/repro.sh +++ b/test/units/testsuite-47-repro.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash sleep infinity & echo $! > /leakedtestpid diff --git a/test/units/testsuite-47.service b/test/units/testsuite-47.service new file mode 100644 index 0000000000..b6015e27cc --- /dev/null +++ b/test/units/testsuite-47.service @@ -0,0 +1,6 @@ +[Unit] +Description=TEST-47-ISSUE-14566 + +[Service] +ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +Type=oneshot diff --git a/test/TEST-47-ISSUE-14566/testsuite.sh b/test/units/testsuite-47.sh similarity index 71% rename from test/TEST-47-ISSUE-14566/testsuite.sh rename to test/units/testsuite-47.sh index a0ba32530e..09be780a68 100755 --- a/test/TEST-47-ISSUE-14566/testsuite.sh +++ b/test/units/testsuite-47.sh @@ -1,17 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex set -o pipefail systemd-analyze log-level debug systemd-analyze log-target console -systemctl start issue_14566_test +systemctl start testsuite-47-repro sleep 1 -systemctl status issue_14566_test +systemctl status testsuite-47-repro leaked_pid=$(cat /leakedtestpid) -systemctl stop issue_14566_test +systemctl stop testsuite-47-repro # Leaked PID will still be around if we're buggy. # I personally prefer to see 42.