mirror of
https://github.com/systemd/systemd.git
synced 2025-02-25 21:57:32 +03:00
test: merge TEST-10-ISSUE-2467 with TEST-07-PID1
This commit is contained in:
parent
4966a31ba3
commit
a8faac7dae
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
../TEST-01-BASIC/Makefile
|
@ -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 "$@"
|
@ -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',
|
||||
|
@ -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
|
17
test/units/testsuite-07.issue-2467.sh
Executable file
17
test/units/testsuite-07.issue-2467.sh
Executable file
@ -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 ]]
|
@ -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'
|
Loading…
x
Reference in New Issue
Block a user