]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: introduce $TEST_SKIP_SHUTDOWN
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 24 Oct 2023 10:35:03 +0000 (12:35 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 24 Oct 2023 10:35:03 +0000 (12:35 +0200)
To get rid of some boilerplate.

test/TEST-69-SHUTDOWN/test.sh
test/TEST-82-SOFTREBOOT/test.sh
test/test-functions

index c7f78fe3c9b8115a9eff68bda221eff7c8e0c691..c813b5534fb2fd4e2b3cc7131ad12ee3743c5664 100755 (executable)
@@ -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"
@@ -23,13 +25,7 @@ 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
-EOF
+
     inst /usr/bin/screen
     echo "PS1='screen\$WINDOW # '" >>"$workspace/root/.bashrc"
     echo 'startup_message off' >"$workspace/etc/screenrc"
index 101b25084269f7613e583ac0deedf7202bc79f71..049414918567804844a91146284ea26a1d8f0780 100755 (executable)
@@ -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 "$@"
index 0c90a310a1af263c101aa10280e591adb2640824..60db47c86aa6908e46943711ecc1ad3a5c299cbe 100644 (file)
@@ -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"
         )
@@ -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