]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: merge TEST-10-ISSUE-2467 with TEST-07-PID1
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 10 May 2023 11:41:03 +0000 (13:41 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 10 May 2023 12:29:38 +0000 (14:29 +0200)
test/TEST-07-PID1/test.sh
test/TEST-10-ISSUE-2467/Makefile [deleted symlink]
test/TEST-10-ISSUE-2467/test.sh [deleted file]
test/meson.build
test/testsuite-07.units/issue2467.service [moved from test/testsuite-10.units/test10.service with 90% similarity]
test/testsuite-07.units/issue2467.socket [moved from test/testsuite-10.units/test10.socket with 100% similarity]
test/units/testsuite-07.issue-2467.sh [new file with mode: 0755]
test/units/testsuite-10.service [deleted file]

index c2418403270c5a65fa006ec5f7eee6fbcc4a3688..1c3d7137feb81f91b15049602401b77642144c4f 100755 (executable)
@@ -10,6 +10,14 @@ TEST_DESCRIPTION="Tests for core PID1 functionality"
 test_append_files() {
     local workspace="${1:?}"
 
+    # Collecting coverage slows this particular test quite a bit, causing
+    # it to fail with the default settings (20 triggers per 2 secs).
+    # Let's help it a bit in such case.
+    if get_bool "$IS_BUILT_WITH_COVERAGE"; then
+        mkdir -p "$workspace/etc/systemd/system/issue2467.socket.d"
+        printf "[Socket]\nTriggerLimitIntervalSec=10\n" >"$workspace/etc/systemd/system/issue2467.socket.d/coverage-override.conf"
+    fi
+
     # Issue: https://github.com/systemd/systemd/issues/2730
     mkdir -p "$workspace/etc/systemd/system/"
     cat >"$workspace/etc/systemd/system/issue2730.mount" <<EOF
diff --git a/test/TEST-10-ISSUE-2467/Makefile b/test/TEST-10-ISSUE-2467/Makefile
deleted file mode 120000 (symlink)
index e9f93b1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../TEST-01-BASIC/Makefile
\ No newline at end of file
diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh
deleted file mode 100755 (executable)
index 8dabf3f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
-
-TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
-
-# shellcheck source=test/test-functions
-. "${TEST_BASE_DIR:?}/test-functions"
-
-test_append_files() {
-    (
-        # Collecting coverage slows this particular test quite a bit, causing
-        # it to fail with the default settings (20 triggers per 2 secs)
-        # to trip over the default limit. Let's help it a bit in such case.
-        if get_bool "$IS_BUILT_WITH_COVERAGE"; then
-            mkdir -p "${initdir:?}/etc/systemd/system/test10.socket.d"
-            printf "[Socket]\nTriggerLimitIntervalSec=10\n" >"${initdir:?}/etc/systemd/system/test10.socket.d/coverage-override.conf"
-        fi
-    )
-}
-
-do_test "$@"
index 61b47e199fd4d44e480d879f198017d904ef2b74..dc3b78be1f84aec2d6883ed2b7300e8bce011fd8 100644 (file)
@@ -15,6 +15,7 @@ if install_tests
                 'testsuite-03.units',
                 'testsuite-04.units',
                 'testsuite-06.units',
+                'testsuite-07.units',
                 'testsuite-10.units',
                 'testsuite-11.units',
                 'testsuite-16.units',
similarity index 90%
rename from test/testsuite-10.units/test10.service
rename to test/testsuite-07.units/issue2467.service
index fc8fad932790b9544731df85f60301336f1529a0..99d886f0252fc1a8b95b6a53c5875ec01ab70484 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 [Unit]
-Requires=test10.socket
+Requires=issue2467.socket
 ConditionPathExistsGlob=/tmp/nonexistent
 # Make sure we hit the socket trigger limit in the test and not the service start limit.
 StartLimitInterval=1000
diff --git a/test/units/testsuite-07.issue-2467.sh b/test/units/testsuite-07.issue-2467.sh
new file mode 100755 (executable)
index 0000000..a5dcfd5
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+# Don't start services every few ms if condition fails
+# Issue: https://github.com/systemd/systemd/issues/2467
+
+rm -f /tmp/nonexistent
+systemctl start issue2467.socket
+nc -w20 -U /run/test.ctl || :
+
+# TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give
+# systemd enough time even on slower machines, to reach the trigger limit.
+# shellcheck disable=SC2016
+timeout 10 bash -c 'while ! [[ "$(systemctl show issue2467.socket -P ActiveState)" == failed ]]; do sleep .5; done'
+[[ "$(systemctl show issue2467.socket -P Result)" == trigger-limit-hit ]]
diff --git a/test/units/testsuite-10.service b/test/units/testsuite-10.service
deleted file mode 100644 (file)
index 9fcfd67..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-[Unit]
-Description=TEST-10-ISSUE-2467
-
-[Service]
-ExecStartPre=rm -f /failed /testok
-Type=oneshot
-ExecStart=rm -f /tmp/nonexistent
-ExecStart=systemctl start test10.socket
-ExecStart=-nc -w20 -U /run/test.ctl
-# TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give
-# systemd enough time even on slower machines, to reach the trigger limit.
-ExecStart=sleep 10
-ExecStart=sh -x -c 'test "$(systemctl show test10.socket -P ActiveState)" = failed'
-ExecStart=sh -x -c 'test "$(systemctl show test10.socket -P Result)" = trigger-limit-hit'
-ExecStart=sh -x -c 'echo OK >/testok'