]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: move test units to their own directories 38807/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Sep 2025 20:12:21 +0000 (05:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Sep 2025 05:36:46 +0000 (14:36 +0900)
This also add test cases for verifying loopy.service and friends,
which was added by e66047ff62c971eefa32b42373420d61e3f2a9c1 but never
used in integration tests.

76 files changed:
src/test/test-cgroup-mask.c
src/test/test-cgroup-unit-default.c
src/test/test-engine.c
src/test/test-sched-prio.c
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh [moved from test/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh with 89% similarity]
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh [moved from test/units/TEST-23-UNIT-FILE-openfile-child.sh with 89% similarity]
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-short-lived.service
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-short-lived.sh [moved from test/units/TEST-23-UNIT-FILE-short-lived.sh with 100% similarity]
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/success-failure-test-failure.service [moved from test/units/success-failure-test-failure.service with 100% similarity]
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/success-failure-test-success.service [moved from test/units/success-failure-test-success.service with 100% similarity]
test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/success-failure-test.service [moved from test/units/success-failure-test.service with 100% similarity]
test/integration-tests/TEST-38-FREEZER/TEST-38-FREEZER.units/TEST-38-FREEZER-sleep.service [moved from test/units/TEST-38-FREEZER-sleep.service with 100% similarity]
test/integration-tests/TEST-55-OOMD/TEST-55-OOMD.units/TEST-55-OOMD-testbloat.service [moved from test/units/TEST-55-OOMD-testbloat.service with 100% similarity]
test/integration-tests/TEST-55-OOMD/TEST-55-OOMD.units/TEST-55-OOMD-testchill.service [moved from test/units/TEST-55-OOMD-testchill.service with 100% similarity]
test/integration-tests/TEST-55-OOMD/TEST-55-OOMD.units/TEST-55-OOMD-testmunch.service [moved from test/units/TEST-55-OOMD-testmunch.service with 100% similarity]
test/integration-tests/TEST-55-OOMD/TEST-55-OOMD.units/TEST-55-OOMD-workload.slice [moved from test/units/TEST-55-OOMD-workload.slice with 100% similarity]
test/integration-tests/TEST-55-OOMD/TEST-55-OOMD.units/TEST-55-OOMD-workload.slice.d/99-oom.conf [moved from test/units/TEST-55-OOMD-workload.slice.d/99-oom.conf with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-1.service [moved from test/units/TEST-62-RESTRICT-IFACES-1.service with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-2.service [moved from test/units/TEST-62-RESTRICT-IFACES-2.service with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-3.service [moved from test/units/TEST-62-RESTRICT-IFACES-3.service with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-4.service [moved from test/units/TEST-62-RESTRICT-IFACES-4.service with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-5.service [moved from test/units/TEST-62-RESTRICT-IFACES-5.service with 100% similarity]
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-6.service [moved from test/units/TEST-62-RESTRICT-IFACES-6.service with 100% similarity]
test/integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units/loopy.service [moved from test/units/loopy.service with 100% similarity]
test/integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units/loopy.service.d/compat.conf [moved from test/units/loopy.service.d/compat.conf with 100% similarity]
test/integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units/loopy2.service [moved from test/units/loopy2.service with 100% similarity]
test/integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units/loopy3.service [moved from test/units/loopy3.service with 100% similarity]
test/integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units/loopy4.service [moved from test/units/loopy4.service with 100% similarity]
test/integration-tests/TEST-66-DEVICE-ISOLATION/TEST-66-DEVICE-ISOLATION.units/TEST-66-DEVICE-ISOLATION-device-isolation.service [moved from test/units/TEST-66-DEVICE-ISOLATION-device-isolation.service with 100% similarity]
test/meson.build
test/test-cgroup-mask/daughter.service [moved from test/units/daughter.service with 100% similarity]
test/test-cgroup-mask/grandchild.service [moved from test/units/grandchild.service with 100% similarity]
test/test-cgroup-mask/nomem.slice [moved from test/units/nomem.slice with 100% similarity]
test/test-cgroup-mask/nomemleaf.service [moved from test/units/nomemleaf.service with 100% similarity]
test/test-cgroup-mask/parent-deep.slice [moved from test/units/parent-deep.slice with 100% similarity]
test/test-cgroup-mask/parent.slice [moved from test/units/parent.slice with 100% similarity]
test/test-cgroup-mask/son.service [moved from test/units/son.service with 100% similarity]
test/test-cgroup-unit-default/dml-discard-empty.service [moved from test/units/dml-discard-empty.service with 100% similarity]
test/test-cgroup-unit-default/dml-discard-set-ml.service [moved from test/units/dml-discard-set-ml.service with 100% similarity]
test/test-cgroup-unit-default/dml-discard.slice [moved from test/units/dml-discard.slice with 100% similarity]
test/test-cgroup-unit-default/dml-override-empty.service [moved from test/units/dml-override-empty.service with 100% similarity]
test/test-cgroup-unit-default/dml-override.slice [moved from test/units/dml-override.slice with 100% similarity]
test/test-cgroup-unit-default/dml-passthrough-empty.service [moved from test/units/dml-passthrough-empty.service with 100% similarity]
test/test-cgroup-unit-default/dml-passthrough-set-dml.service [moved from test/units/dml-passthrough-set-dml.service with 100% similarity]
test/test-cgroup-unit-default/dml-passthrough-set-ml.service [moved from test/units/dml-passthrough-set-ml.service with 100% similarity]
test/test-cgroup-unit-default/dml-passthrough.slice [moved from test/units/dml-passthrough.slice with 100% similarity]
test/test-cgroup-unit-default/dml.slice [moved from test/units/dml.slice with 100% similarity]
test/test-engine/a-conj.service [moved from test/units/a-conj.service with 100% similarity]
test/test-engine/a.service [moved from test/units/a.service with 100% similarity]
test/test-engine/b.service [moved from test/units/b.service with 100% similarity]
test/test-engine/basic.target [moved from test/units/basic.target with 100% similarity]
test/test-engine/c.service [moved from test/units/c.service with 100% similarity]
test/test-engine/d.service [moved from test/units/d.service with 100% similarity]
test/test-engine/e.service [moved from test/units/e.service with 100% similarity]
test/test-engine/f.service [moved from test/units/f.service with 100% similarity]
test/test-engine/g.service [moved from test/units/g.service with 100% similarity]
test/test-engine/h.service [moved from test/units/h.service with 100% similarity]
test/test-engine/i.service [moved from test/units/i.service with 100% similarity]
test/test-engine/sysinit.target [moved from test/units/sysinit.target with 86% similarity]
test/test-engine/unit-.service.d/10-override.conf [moved from test/units/unit-.service.d/10-override.conf with 100% similarity]
test/test-engine/unit-with-.service.d/20-override.conf [moved from test/units/unit-with-.service.d/20-override.conf with 100% similarity]
test/test-engine/unit-with-multiple-.service.d/20-override.conf [moved from test/units/unit-with-multiple-.service.d/20-override.conf with 100% similarity]
test/test-engine/unit-with-multiple-.service.d/30-override.conf [moved from test/units/unit-with-multiple-.service.d/30-override.conf with 100% similarity]
test/test-engine/unit-with-multiple-dashes.service [moved from test/units/unit-with-multiple-dashes.service with 100% similarity]
test/test-engine/unit-with-multiple-dashes.service.d/10-override.conf [moved from test/units/unit-with-multiple-dashes.service.d/10-override.conf with 100% similarity]
test/test-sched-prio/sched_idle_bad.service [moved from test/units/sched_idle_bad.service with 100% similarity]
test/test-sched-prio/sched_idle_ok.service [moved from test/units/sched_idle_ok.service with 100% similarity]
test/test-sched-prio/sched_rr_bad.service [moved from test/units/sched_rr_bad.service with 100% similarity]
test/test-sched-prio/sched_rr_change.service [moved from test/units/sched_rr_change.service with 100% similarity]
test/test-sched-prio/sched_rr_ok.service [moved from test/units/sched_rr_ok.service with 100% similarity]
test/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh
test/units/TEST-23-UNIT-FILE.openfile.sh
test/units/TEST-65-ANALYZE.sh
test/units/shutdown.target [deleted file]
test/units/sockets.target [deleted file]
test/units/timers.target [deleted file]

index 2a39d344ee1a138c152f2b762e2aa6e4800c0c00..3dcb5fde8307eacc94549e444a3aa9bf7e6e049a 100644 (file)
@@ -32,7 +32,7 @@ TEST_RET(cgroup_mask, .sd_booted = true) {
 
         /* Prepare the manager. */
         _cleanup_free_ char *unit_dir = NULL;
-        ASSERT_OK(get_testdata_dir("units", &unit_dir));
+        ASSERT_OK(get_testdata_dir("test-cgroup-mask", &unit_dir));
         ASSERT_OK(setenv_unit_path(unit_dir));
         assert_se(runtime_dir = setup_fake_runtime_dir());
         r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
index 2e53b0e1c8dd07f612a3b69c3caeb3346be8b017..a84152413411b9bcb497c80c1232ff604445d3ad 100644 (file)
@@ -21,7 +21,7 @@ TEST_RET(default_memory_low, .sd_booted = true) {
                 return log_tests_skipped("cgroupfs not available");
 
         _cleanup_free_ char *unit_dir = NULL;
-        ASSERT_OK(get_testdata_dir("units", &unit_dir));
+        ASSERT_OK(get_testdata_dir("test-cgroup-unit-default", &unit_dir));
         ASSERT_OK(setenv_unit_path(unit_dir));
         assert_se(runtime_dir = setup_fake_runtime_dir());
         r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
index 56b7920d8d7214a336fd169cab56d4da4bc16412..06a1d9e6fd49a41fb85fb34e9a102dcdf94faff6 100644 (file)
@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
 
         /* prepare the test */
         _cleanup_free_ char *unit_dir = NULL;
-        ASSERT_OK(get_testdata_dir("units", &unit_dir));
+        ASSERT_OK(get_testdata_dir("test-engine", &unit_dir));
         ASSERT_OK(setenv_unit_path(unit_dir));
         assert_se(runtime_dir = setup_fake_runtime_dir());
 
index ca0d75d132b57185dfd0ee425a20da5b0b68225f..1dfa91d10a43b748e45deaebfa6a96f8cbf7f16d 100644 (file)
@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
 
         /* prepare the test */
         _cleanup_free_ char *unit_dir = NULL;
-        ASSERT_OK(get_testdata_dir("units", &unit_dir));
+        ASSERT_OK(get_testdata_dir("test-sched-prio", &unit_dir));
         ASSERT_OK(setenv_unit_path(unit_dir));
         assert_se(runtime_dir = setup_fake_runtime_dir());
 
similarity index 89%
rename from test/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh
rename to test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh
index 8b182955b5cd475e1722a78c405d51c031f76cd1..2b3a6d368fb057153c656d29a6b88e797e141853 100755 (executable)
@@ -4,7 +4,7 @@ set -eux
 set -o pipefail
 
 # shellcheck source=test/units/util.sh
-. "$(dirname "$0")"/util.sh
+. "$(dirname "$0")"/../units/util.sh
 
 assert_eq "$LISTEN_FDS" "$1"
 assert_eq "$LISTEN_FDNAMES" "$2"
similarity index 89%
rename from test/units/TEST-23-UNIT-FILE-openfile-child.sh
rename to test/integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh
index 4828b9dc10da5dd0df5c34cea138d1c39fc5e013..9ed6509affe9dd76701466848f2d274901621135 100755 (executable)
@@ -4,7 +4,7 @@ set -eux
 set -o pipefail
 
 # shellcheck source=test/units/util.sh
-. "$(dirname "$0")"/util.sh
+. "$(dirname "$0")"/../units/util.sh
 
 assert_eq "$LISTEN_FDS" "$1"
 assert_eq "$LISTEN_FDNAMES" "$2"
index ac9583f9169038c8c19ecfabdc1606aaa8455464..973d5799df8014138627f1decd1e2fa583caf3dc 100644 (file)
@@ -8,4 +8,4 @@ StartLimitBurst=15
 StartLimitIntervalSec=1h
 
 [Service]
-ExecStart=/usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-short-lived.sh
+ExecStart=/usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-short-lived.sh
index 7b760dc57242f4e4534ea152abd8021e1906e7d7..4cdd2f430367f9b59109be29adbd1417416413e7 100644 (file)
@@ -339,15 +339,18 @@ if install_tests
                 'auxv',
                 'journal-data',
                 'knot-data',
-                'test-journals',
-                'units',
+                'test-cgroup-mask',
+                'test-cgroup-unit-default',
+                'test-engine',
                 'test-execute',
                 'test-fstab-generator',
+                'test-journals',
+                'test-network',
+                'test-network-generator-conversion',
                 'test-path',
                 'test-path-util',
+                'test-sched-prio',
                 'test-umount',
-                'test-network',
-                'test-network-generator-conversion',
                 'integration-tests/TEST-07-PID1/TEST-07-PID1.units',
                 'integration-tests/TEST-03-JOBS/TEST-03-JOBS.units',
                 'integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units',
@@ -355,9 +358,15 @@ if install_tests
                 'integration-tests/TEST-16-EXTEND-TIMEOUT/TEST-16-EXTEND-TIMEOUT.units',
                 'integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units',
                 'integration-tests/TEST-30-ONCLOCKCHANGE/TEST-30-ONCLOCKCHANGE.units',
+                'integration-tests/TEST-38-FREEZER/TEST-38-FREEZER.units',
                 'integration-tests/TEST-52-HONORFIRSTSHUTDOWN/TEST-52-HONORFIRSTSHUTDOWN.units',
+                'integration-tests/TEST-55-OOMD/TEST-55-OOMD.units',
+                'integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units',
                 'integration-tests/TEST-63-PATH/TEST-63-PATH.units',
+                'integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units',
+                'integration-tests/TEST-66-DEVICE-ISOLATION/TEST-66-DEVICE-ISOLATION.units',
                 'integration-tests/TEST-80-NOTIFYACCESS/TEST-80-NOTIFYACCESS.units',
+                'units',
         ]
 
         foreach subdir : testdata_subdirs
similarity index 86%
rename from test/units/sysinit.target
rename to test/test-engine/sysinit.target
index eed3d16b458519b1ef6ecc99d24d4795538dc1b9..5187605a3c43c578a71ab62cb435cdc73d2f4ef6 100644 (file)
@@ -10,6 +10,8 @@
 [Unit]
 Description=System Initialization
 Documentation=man:systemd.special(7)
-Conflicts=emergency.service emergency.target
+
 Wants=local-fs.target swap.target
-After=local-fs.target swap.target emergency.service emergency.target
+After=local-fs.target swap.target
+Conflicts=emergency.service emergency.target
+Before=emergency.service emergency.target
index eaeee635db6a0ef47ed8e03521176c3483d966c7..ddeeb854bca688acf1603c5a27b7a66fcd5d76d1 100755 (executable)
@@ -31,8 +31,8 @@ busctl call \
     org.freedesktop.systemd1.Manager StartTransientUnit \
     "ssa(sv)a(sa(sv))" "$TEST_UNIT" replace 4 \
       ExecStart "a(sasb)" 1 \
-        /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh \
-        5 /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh 2 "test:other" "Hello" "Extra" \
+        /usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh \
+        5 /usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh 2 "test:other" "Hello" "Extra" \
         true \
       RemainAfterExit "b" true \
       Type "s" oneshot \
index 644b6f458ed45f2c9317b62425851e05007696c2..0e2e22a01d2a275950d2665e7e699f860bdd3834 100755 (executable)
@@ -28,7 +28,7 @@ systemd-run -p DynamicUser=yes -p EnvironmentFile=-/usr/lib/systemd/systemd-asan
             -p RemainAfterExit=yes \
             --unit=test-23-openfile-existing.service \
             --service-type=oneshot \
-            /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh 2 "open.txt:colon" "Open" "File"
+            /usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh 2 "open.txt:colon" "Open" "File"
 
 cmp <(systemctl show -p OpenFile test-23-openfile-existing.service) <<EOF
 OpenFile=/tmp/test-open-file/open.txt::read-only
@@ -43,7 +43,7 @@ systemctl start TEST-23-UNIT-FILE-openfile-server.socket
 
 systemd-run -p OpenFile=/tmp/test.sock:socket:read-only \
             --wait \
-            /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh 1 "socket" "Socket"
+            /usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh 1 "socket" "Socket"
 
 systemctl stop TEST-23-UNIT-FILE-openfile-server.socket
 
index 721f4ca80966bd312eab59b139e8366219b3074f..0c5b538cc9bb93187ae1b1b49a1a4827edf492aa 100755 (executable)
@@ -510,6 +510,12 @@ systemd-analyze verify /tmp/testwarnings.service
 
 rm /tmp/testwarnings.service
 
+TESTDATA=/usr/lib/systemd/tests/testdata/TEST-65-ANALYZE.units
+systemd-analyze verify "${TESTDATA}/loopy.service"
+systemd-analyze verify "${TESTDATA}/loopy2.service"
+systemd-analyze verify "${TESTDATA}/loopy3.service"
+systemd-analyze verify "${TESTDATA}/loopy4.service"
+
 # Added an additional "INVALID_ID" id to the .json to verify that nothing breaks when input is malformed
 # The PrivateNetwork id description and weight was changed to verify that 'security' is actually reading in
 # values from the .json file when required. The default weight for "PrivateNetwork" is 2500, and the new weight
diff --git a/test/units/shutdown.target b/test/units/shutdown.target
deleted file mode 100644 (file)
index 582ae6b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#  SPDX-License-Identifier: LGPL-2.1-or-later
-#
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-[Unit]
-Description=Shutdown
-Documentation=man:systemd.special(7)
-DefaultDependencies=no
-RefuseManualStart=yes
diff --git a/test/units/sockets.target b/test/units/sockets.target
deleted file mode 100644 (file)
index c6e20d7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#  SPDX-License-Identifier: LGPL-2.1-or-later
-#
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-[Unit]
-Description=Sockets
-Documentation=man:systemd.special(7)
diff --git a/test/units/timers.target b/test/units/timers.target
deleted file mode 100644 (file)
index 99f82e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  SPDX-License-Identifier: LGPL-2.1-or-later
-#
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-[Unit]
-Description=Timers
-Documentation=man:systemd.special(7)
-
-DefaultDependencies=no
-Conflicts=shutdown.target