Skip to content

Commit

Permalink
Merge pull request systemd#29689 from mrc0mmand/test-shutdown
Browse files Browse the repository at this point in the history
test: shorten service stop/abort timeouts for TEST-69-SHUTDOWN
  • Loading branch information
bluca authored Oct 24, 2023
2 parents 648fbfe + 270b20b commit b7180e4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
20 changes: 13 additions & 7 deletions test/TEST-69-SHUTDOWN/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ set -e

TEST_DESCRIPTION="shutdown testing"
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
. "${TEST_BASE_DIR:?}/test-functions"
Expand All @@ -23,13 +25,17 @@ EOF

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

# Shorten the service stop/abort timeouts to let systemd SIGKILL stubborn
# processes as soon as possible, as we don't really care about them in this
# particular test
mkdir -p "$workspace/etc/systemd/system.conf.d"
cat >"$workspace/etc/systemd/system.conf.d/99-timeout.conf" <<EOF
[Manager]
DefaultTimeoutStopSec=30s
DefaultTimeoutAbortSec=30s
EOF

inst /usr/bin/screen
echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc"
echo 'startup_message off' >"$workspace/etc/screenrc"
Expand Down
13 changes: 2 additions & 11 deletions test/TEST-82-SOFTREBOOT/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,10 @@ set -e
TEST_DESCRIPTION="Test Soft-Rebooting"
# We temporarily remount rootfs read-only, so ignore any missing coverage
IGNORE_MISSING_COVERAGE=yes
# Prevent shutdown in test suite, the expect script does that manually.
TEST_SKIP_SHUTDOWN=yes

# shellcheck source=test/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 "$@"
6 changes: 3 additions & 3 deletions test/test-functions
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,13 @@ run_qemu() {
"systemd.unit=testsuite.target"
"systemd.wants=testsuite-$1.service"
"noresume"
"oops=panic"
${TEST_MATCH_SUBTEST:+"systemd.setenv=TEST_MATCH_SUBTEST=$TEST_MATCH_SUBTEST"}
${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+=(
"oops=panic"
"panic=1"
"systemd.wants=end.service"
)
Expand Down Expand Up @@ -666,7 +666,7 @@ run_nspawn() {

if get_bool "$INTERACTIVE_DEBUG"; then
nspawn_options+=("--console=interactive")
else
elif ! get_bool "$TEST_SKIP_SHUTDOWN"; then
kernel_params+=("systemd.wants=end.service")
fi

Expand Down

0 comments on commit b7180e4

Please sign in to comment.