mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
Cleanups for test/units directory (#38807)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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
|
||||
|
||||
@@ -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-path',
|
||||
'test-path-util',
|
||||
'test-umount',
|
||||
'test-journals',
|
||||
'test-network',
|
||||
'test-network-generator-conversion',
|
||||
'test-path',
|
||||
'test-path-util',
|
||||
'test-sched-prio',
|
||||
'test-umount',
|
||||
'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
|
||||
|
||||
@@ -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
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
# We use a custom autorelabel service instead of the SELinux provided set of
|
||||
# units & a generator, since the generator overrides the default target to the
|
||||
# SELinux one when it detects /.autorelabel. However, we use systemd.unit= on
|
||||
# the kernel command cmdline which always takes precedence, rendering all
|
||||
# SELinux efforts useless. Also, pulling in selinux-autorelabel.service
|
||||
# explicitly doesn't work either, as it doesn't check for the presence of
|
||||
# /.autorelabel and does the relabeling unconditionally which always ends with
|
||||
# a reboot, so we end up in a reboot loop (and it also spews quite a lot of
|
||||
# errors as it wants /etc/fstab and dracut-initramfs-restore).
|
||||
|
||||
[Unit]
|
||||
Description=Relabel all filesystems
|
||||
DefaultDependencies=no
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user