1
0
mirror of https://github.com/systemd/systemd.git synced 2025-09-13 05:44:40 +03:00

Merge pull request #29689 from mrc0mmand/test-shutdown

test: shorten service stop/abort timeouts for TEST-69-SHUTDOWN
This commit is contained in:
Luca Boccassi
2023-10-24 20:39:34 +01:00
committed by GitHub
3 changed files with 18 additions and 21 deletions

View File

@@ -4,7 +4,9 @@ set -e
TEST_DESCRIPTION="shutdown testing" TEST_DESCRIPTION="shutdown testing"
IMAGE_NAME="shutdown" IMAGE_NAME="shutdown"
TEST_NO_QEMU=1 TEST_NO_QEMU=yes
# Prevent shutdown in test suite, the expect script does that manually.
TEST_SKIP_SHUTDOWN=yes
# shellcheck source=test/test-functions # shellcheck source=test/test-functions
. "${TEST_BASE_DIR:?}/test-functions" . "${TEST_BASE_DIR:?}/test-functions"
@@ -23,13 +25,17 @@ EOF
test_append_files() { test_append_files() {
local workspace="${1:?}" local workspace="${1:?}"
# prevent shutdown in test suite, the expect script does that manually.
mkdir -p "${workspace:?}/etc/systemd/system/end.service.d" # Shorten the service stop/abort timeouts to let systemd SIGKILL stubborn
cat >"$workspace/etc/systemd/system/end.service.d/99-override.conf" <<EOF # processes as soon as possible, as we don't really care about them in this
[Service] # particular test
ExecStart= mkdir -p "$workspace/etc/systemd/system.conf.d"
ExecStart=/bin/true cat >"$workspace/etc/systemd/system.conf.d/99-timeout.conf" <<EOF
[Manager]
DefaultTimeoutStopSec=30s
DefaultTimeoutAbortSec=30s
EOF EOF
inst /usr/bin/screen inst /usr/bin/screen
echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc" echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc"
echo 'startup_message off' >"$workspace/etc/screenrc" echo 'startup_message off' >"$workspace/etc/screenrc"

View File

@@ -5,19 +5,10 @@ set -e
TEST_DESCRIPTION="Test Soft-Rebooting" TEST_DESCRIPTION="Test Soft-Rebooting"
# We temporarily remount rootfs read-only, so ignore any missing coverage # We temporarily remount rootfs read-only, so ignore any missing coverage
IGNORE_MISSING_COVERAGE=yes IGNORE_MISSING_COVERAGE=yes
# Prevent shutdown in test suite, the expect script does that manually.
TEST_SKIP_SHUTDOWN=yes
# shellcheck source=test/test-functions # shellcheck source=test/test-functions
. "$TEST_BASE_DIR/test-functions" . "$TEST_BASE_DIR/test-functions"
test_append_files() {
local workspace="${1:?}"
# prevent shutdown in test suite, the expect script does that manually.
mkdir -p "${workspace:?}/etc/systemd/system/end.service.d"
cat >"$workspace/etc/systemd/system/end.service.d/99-override.conf" <<EOF
[Service]
ExecStart=
ExecStart=/bin/true
EOF
}
do_test "$@" do_test "$@"

View File

@@ -561,13 +561,13 @@ run_qemu() {
"systemd.unit=testsuite.target" "systemd.unit=testsuite.target"
"systemd.wants=testsuite-$1.service" "systemd.wants=testsuite-$1.service"
"noresume" "noresume"
"oops=panic"
${TEST_MATCH_SUBTEST:+"systemd.setenv=TEST_MATCH_SUBTEST=$TEST_MATCH_SUBTEST"} ${TEST_MATCH_SUBTEST:+"systemd.setenv=TEST_MATCH_SUBTEST=$TEST_MATCH_SUBTEST"}
${TEST_MATCH_TESTCASE:+"systemd.setenv=TEST_MATCH_TESTCASE=$TEST_MATCH_TESTCASE"} ${TEST_MATCH_TESTCASE:+"systemd.setenv=TEST_MATCH_TESTCASE=$TEST_MATCH_TESTCASE"}
) )
if ! get_bool "$INTERACTIVE_DEBUG"; then if ! get_bool "$INTERACTIVE_DEBUG" && ! get_bool "$TEST_SKIP_SHUTDOWN"; then
kernel_params+=( kernel_params+=(
"oops=panic"
"panic=1" "panic=1"
"systemd.wants=end.service" "systemd.wants=end.service"
) )
@@ -666,7 +666,7 @@ run_nspawn() {
if get_bool "$INTERACTIVE_DEBUG"; then if get_bool "$INTERACTIVE_DEBUG"; then
nspawn_options+=("--console=interactive") nspawn_options+=("--console=interactive")
else elif ! get_bool "$TEST_SKIP_SHUTDOWN"; then
kernel_params+=("systemd.wants=end.service") kernel_params+=("systemd.wants=end.service")
fi fi