]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: move TEST-16-EXTEND-TIMEOUT setup to static files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Dec 2019 07:16:40 +0000 (08:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 10:46:47 +0000 (11:46 +0100)
13 files changed:
test/TEST-16-EXTEND-TIMEOUT/test.sh
test/TEST-16-EXTEND-TIMEOUT/testsuite.service [deleted file]
test/meson.build
test/testsuite-16.units/extend-timeout.sh [moved from test/TEST-16-EXTEND-TIMEOUT/extend_timeout_test_service.sh with 100% similarity]
test/testsuite-16.units/fail-runtime.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-runtime.service with 68% similarity]
test/testsuite-16.units/fail-start.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-start.service with 68% similarity]
test/testsuite-16.units/fail-stop.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-stop.service with 79% similarity]
test/testsuite-16.units/success-all.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-all.service with 69% similarity]
test/testsuite-16.units/success-runtime.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-runtime.service with 62% similarity]
test/testsuite-16.units/success-start.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-start.service with 63% similarity]
test/testsuite-16.units/success-stop.service [moved from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-stop.service with 63% similarity]
test/units/testsuite-16.service [new file with mode: 0644]
test/units/testsuite-16.sh [moved from test/TEST-16-EXTEND-TIMEOUT/assess.sh with 94% similarity]

index 43d9f1278b3c8658b3f5ce5c4aae08ab9ab4340a..474b9db2fcc03341f9b2876ff8b0e9348d0a8ecb 100755 (executable)
@@ -15,21 +15,9 @@ test_setup() {
 
         setup_basic_environment
         mask_supporting_services
-
-        for s in success-all success-start success-stop success-runtime \
-                 fail-start fail-stop fail-runtime
-        do
-            cp testsuite-${s}.service ${initdir}/etc/systemd/system
-        done
-        cp testsuite.service ${initdir}/etc/systemd/system
-
-        cp extend_timeout_test_service.sh ${initdir}/
-        cp assess.sh ${initdir}/
-
-        setup_testsuite
     )
 
     setup_nspawn_root
 }
 
-do_test "$@"
+do_test "$@" 16
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite.service b/test/TEST-16-EXTEND-TIMEOUT/testsuite.service
deleted file mode 100644 (file)
index 7512ba9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-[Unit]
-Description=Testsuite: Assess all other testsuite-*.services worked as expected
-
-Wants=testsuite-success-all.service
-Wants=testsuite-success-start.service
-Wants=testsuite-success-runtime.service
-Wants=testsuite-success-stop.service
-Wants=testsuite-fail-start.service
-Wants=testsuite-fail-stop.service
-Wants=testsuite-fail-runtime.service
-StopWhenUnneeded=yes
-
-[Service]
-Type=simple
-TimeoutStartSec=infinity
-ExecStartPre=/assess.sh
-ExecStart=/bin/true
index 61e0aee13f2c9b828d9d31cc1520835f268662aa..6fea0fc93d2e1b13d1fdb96f6d932dca5ff83287 100644 (file)
@@ -20,6 +20,8 @@ install_subdir('testsuite-10.units',
                install_dir : testdata_dir)
 install_subdir('testsuite-11.units',
                install_dir : testdata_dir)
+install_subdir('testsuite-16.units',
+               install_dir : testdata_dir)
 
 testsuite08_dir = testdata_dir + '/testsuite-08.units'
 install_data('testsuite-08.units/-.mount',
similarity index 68%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-runtime.service
rename to test/testsuite-16.units/fail-runtime.service
index e0b9f6a70b489c4c0f5bbbd65c931ca31d7e0e56..06417f7133cf18ce38b5fb7636ade3f4046c1e8b 100644 (file)
@@ -1,13 +1,11 @@
-
 [Unit]
 Description=Testsuite: Fail Runtime (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after RuntimeSecMax.)
 
 [Service]
-
 # EXTEND_TIMEOUT_USEC on runtime start (0) and 7 seconds after. Systemd will expect one at 7+5 (extend_timeout_interval)
 # seconds this won't happen until 7 + 7 (sleep interval) seconds. Therefore timeout at 12 seconds.
 Type=notify
 TimeoutStartSec=4
 TimeoutStopSec=4
 RuntimeMaxSec=10
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
similarity index 68%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-start.service
rename to test/testsuite-16.units/fail-start.service
index c3fcf23dc021a81551def8cc176dc55c04d0d47c..95e9b01d12dfbcd31961782835e0b3a7c5380b7d 100644 (file)
@@ -1,4 +1,3 @@
-
 [Unit]
 Description=Testsuite: Fail Start (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after TimeoutStartSec.)
 
@@ -10,4 +9,4 @@ Type=notify
 TimeoutStartSec=10
 TimeoutStopSec=4
 RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
similarity index 79%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-stop.service
rename to test/testsuite-16.units/fail-stop.service
index ce76d10db74e528a169a75e7e365dae058119da7..7fc66003a48162e770268adaa89efb78016b9b55 100644 (file)
@@ -1,16 +1,14 @@
-
 [Unit]
 Description=Testsuite: Fail Stop (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after TimeoutStopSec.)
 
 [Service]
-
 # EXTEND_TIMEOUT_USEC on stop (0) and 7 seconds after. Systemd will expect one at 7+5 (extend_timeout_interval)
 # seconds this won't happen until 7 + 7 (sleep interval) seconds. Therefore timeout at 12 seconds.
 Type=notify
 TimeoutStartSec=4
 TimeoutStopSec=10
 RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
 # Due to 6041a7ee2c1bbff6301082f192fc1b0882400d42 SIGTERM isn't sent as the service shuts down with STOPPING=1
 # This file makes the test assess.sh quicker by notifing it that this test has finished.
 ExecStopPost=/bin/bash -c '[[ $SERVICE_RESULT == timeout && $EXIT_CODE == killed ]] && touch /fail_runtime.terminated'
similarity index 69%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-all.service
rename to test/testsuite-16.units/success-all.service
index 666f4229bfe72c7b25402a442e658bd18c884cc9..c30ee78dfa99b58f06ee553503ef599547a7c756 100644 (file)
@@ -1,4 +1,3 @@
-
 [Unit]
 Description=Testsuite: EXTEND_TIMEOUT_USEC Success - extend timeout on all services
 
@@ -11,4 +10,4 @@ Type=notify
 TimeoutStartSec=4
 TimeoutStopSec=4
 RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
similarity index 62%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-runtime.service
rename to test/testsuite-16.units/success-runtime.service
index dc226f505464fc40a57a3aab182fd4026f0b5cec..8f83cdb4a1eb3439e4a7eca4b0160825139167f8 100644 (file)
@@ -1,4 +1,3 @@
-
 [Unit]
 Description=Testsuite: Success Runtime (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < RuntimeMaxSec)
 
@@ -10,4 +9,4 @@ Type=notify
 TimeoutStartSec=4
 TimeoutStopSec=4
 RuntimeMaxSec=8
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
similarity index 63%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-start.service
rename to test/testsuite-16.units/success-start.service
index 228eece73edde28b1e6ba0ce290f8abbcc3c7035..26c74390c04d345bb70c6f452e3ad8eb8d4dada9 100644 (file)
@@ -1,13 +1,11 @@
-
 [Unit]
 Description=Testsuite: Success Start (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < TimeoutStartSec)
 
 [Service]
-
 # EXTEND_TIMEOUT_USEC=4 second interval once at startup, but sleep 6 seconds.
 # Therefore startup is 6 seconds and < TimeoutStartSec so still successful.
 Type=notify
 TimeoutStartSec=8
 TimeoutStopSec=4
 RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
similarity index 63%
rename from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-stop.service
rename to test/testsuite-16.units/success-stop.service
index b809397bf3ead0152f7894f2c40183e0fb12da71..b20908ad7599a866dffad1255994233b51b0ebe6 100644 (file)
@@ -1,13 +1,11 @@
-
 [Unit]
 Description=Testsuite: Success Stop (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < TimeoutStopSec)
 
 [Service]
-
 # EXTEND_TIMEOUT_USEC=4 seconds once during shutdown, but sleep for 6 seconds.
 # Therefore stop time is 6 seconds and < TimeoutStopSec so still successful.
 Type=notify
 TimeoutStartSec=4
 TimeoutStopSec=8
 RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
diff --git a/test/units/testsuite-16.service b/test/units/testsuite-16.service
new file mode 100644 (file)
index 0000000..1ebf3d3
--- /dev/null
@@ -0,0 +1,18 @@
+[Unit]
+Description=TEST-16-EXTEND-TIMEOUT
+# Testsuite: Assess all other testsuite-*.services worked as expected
+
+Wants=success-all.service
+Wants=success-start.service
+Wants=success-runtime.service
+Wants=success-stop.service
+Wants=fail-start.service
+Wants=fail-stop.service
+Wants=fail-runtime.service
+StopWhenUnneeded=yes
+
+[Service]
+Type=simple
+TimeoutStartSec=infinity
+ExecStartPre=/usr/lib/systemd/tests/testdata/units/%N.sh
+ExecStart=true
similarity index 94%
rename from test/TEST-16-EXTEND-TIMEOUT/assess.sh
rename to test/units/testsuite-16.sh
index 6f98810b30624d09d2ee8479a81be9fd799e3333..68e556124518c5e1bb390c0ac7a001dab72cfcd1 100755 (executable)
@@ -19,7 +19,7 @@ function wait_for()
 
     if [[ ! -f /${service}.${result} ]]
     then
-        journalctl -u testsuite-${service/_/-}.service >> "${TL}"
+        journalctl -u ${service/_/-}.service >> "${TL}"
     fi
 }