From da8a864aae13f8b54b0f8ba619a704c026e0f2d2 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 10 May 2023 14:19:40 +0200 Subject: [PATCH] test: merge TEST-47-ISSUE-14566 into TEST-07-PID1 (cherry picked from commit 11562ee585d5f2e42cb583f06aa01c7383d85f55) Related: #2213521 --- test/TEST-47-ISSUE-14566/Makefile | 1 - test/TEST-47-ISSUE-14566/test.sh | 10 ------ .../issue14566-repro.service} | 2 +- .../issue14566-repro.sh} | 0 test/units/testsuite-07.issue-14566.sh | 31 +++++++++++++++++++ test/units/testsuite-47.service | 8 ----- test/units/testsuite-47.sh | 25 --------------- 7 files changed, 32 insertions(+), 45 deletions(-) delete mode 120000 test/TEST-47-ISSUE-14566/Makefile delete mode 100755 test/TEST-47-ISSUE-14566/test.sh rename test/{units/testsuite-47-repro.service => testsuite-07.units/issue14566-repro.service} (66%) rename test/{units/testsuite-47-repro.sh => testsuite-07.units/issue14566-repro.sh} (100%) create mode 100755 test/units/testsuite-07.issue-14566.sh delete mode 100644 test/units/testsuite-47.service delete mode 100755 test/units/testsuite-47.sh diff --git a/test/TEST-47-ISSUE-14566/Makefile b/test/TEST-47-ISSUE-14566/Makefile deleted file mode 120000 index e9f93b1104..0000000000 --- a/test/TEST-47-ISSUE-14566/Makefile +++ /dev/null @@ -1 +0,0 @@ -../TEST-01-BASIC/Makefile \ No newline at end of file diff --git a/test/TEST-47-ISSUE-14566/test.sh b/test/TEST-47-ISSUE-14566/test.sh deleted file mode 100755 index 8bdbe14b97..0000000000 --- a/test/TEST-47-ISSUE-14566/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later -set -e - -TEST_DESCRIPTION="Test that KillMode=mixed does not leave left over processes with ExecStopPost=" - -# shellcheck source=test/test-functions -. "${TEST_BASE_DIR:?}/test-functions" - -do_test "$@" diff --git a/test/units/testsuite-47-repro.service b/test/testsuite-07.units/issue14566-repro.service similarity index 66% rename from test/units/testsuite-47-repro.service rename to test/testsuite-07.units/issue14566-repro.service index 1508ac6242..56805963b4 100644 --- a/test/units/testsuite-47-repro.service +++ b/test/testsuite-07.units/issue14566-repro.service @@ -3,6 +3,6 @@ Description=Issue 14566 Repro [Service] -ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +ExecStart=/usr/lib/systemd/tests/testdata/testsuite-07.units/%N.sh ExecStopPost=/bin/true KillMode=mixed diff --git a/test/units/testsuite-47-repro.sh b/test/testsuite-07.units/issue14566-repro.sh similarity index 100% rename from test/units/testsuite-47-repro.sh rename to test/testsuite-07.units/issue14566-repro.sh diff --git a/test/units/testsuite-07.issue-14566.sh b/test/units/testsuite-07.issue-14566.sh new file mode 100755 index 0000000000..e17c3934c1 --- /dev/null +++ b/test/units/testsuite-07.issue-14566.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux +set -o pipefail + +# Test that KillMode=mixed does not leave left over processes with ExecStopPost= +# Issue: https://github.com/systemd/systemd/issues/14566 + +if [[ -n "${ASAN_OPTIONS:-}" ]]; then + # Temporarily skip this test when running with sanitizers due to a deadlock + # See: https://bugzilla.redhat.com/show_bug.cgi?id=2098125 + echo "Sanitizers detected, skipping the test..." + exit 0 +fi + +systemd-analyze log-level debug + +systemctl start issue14566-repro +sleep 4 +systemctl status issue14566-repro + +leaked_pid=$(cat /leakedtestpid) + +systemctl stop issue14566-repro +sleep 4 + +# Leaked PID will still be around if we're buggy. +# I personally prefer to see 42. +ps -p "$leaked_pid" && exit 42 + +systemd-analyze log-level info diff --git a/test/units/testsuite-47.service b/test/units/testsuite-47.service deleted file mode 100644 index d5ad480108..0000000000 --- a/test/units/testsuite-47.service +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -[Unit] -Description=TEST-47-ISSUE-14566 - -[Service] -ExecStartPre=rm -f /failed /testok -ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh -Type=oneshot diff --git a/test/units/testsuite-47.sh b/test/units/testsuite-47.sh deleted file mode 100755 index 529e9617a5..0000000000 --- a/test/units/testsuite-47.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later -set -eux -set -o pipefail - -systemd-analyze log-level debug - -systemctl start testsuite-47-repro -sleep 4 -systemctl status testsuite-47-repro - -leaked_pid=$(cat /leakedtestpid) - -systemctl stop testsuite-47-repro -sleep 4 - -# Leaked PID will still be around if we're buggy. -# I personally prefer to see 42. -ps -p "$leaked_pid" && exit 42 - -systemd-analyze log-level info - -echo OK >/testok - -exit 0