diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-16 20:41:35 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-16 23:07:45 +0200 |
commit | 16eb5687662091a5a8c7ca7e22b176449d6c1099 (patch) | |
tree | 421cf9f9b18133eacbea55b7a3d3a74624ffe85a | |
parent | 518c3e272234c0a59eaac01779481fa2ef399195 (diff) | |
download | systemd-16eb5687662091a5a8c7ca7e22b176449d6c1099.tar.gz |
test: merge TEST-48-START-STOP-NO-RELOAD into TEST-23-UNIT-FILE
l--------- | test/TEST-48-START-STOP-NO-RELOAD/Makefile | 1 | ||||
-rwxr-xr-x | test/TEST-48-START-STOP-NO-RELOAD/test.sh | 12 | ||||
-rwxr-xr-x | test/units/testsuite-23.start-stop-no-reload.sh (renamed from test/units/testsuite-48.sh) | 59 | ||||
-rw-r--r-- | test/units/testsuite-48.service | 8 |
4 files changed, 33 insertions, 47 deletions
diff --git a/test/TEST-48-START-STOP-NO-RELOAD/Makefile b/test/TEST-48-START-STOP-NO-RELOAD/Makefile deleted file mode 120000 index e9f93b1104..0000000000 --- a/test/TEST-48-START-STOP-NO-RELOAD/Makefile +++ /dev/null @@ -1 +0,0 @@ -../TEST-01-BASIC/Makefile
\ No newline at end of file diff --git a/test/TEST-48-START-STOP-NO-RELOAD/test.sh b/test/TEST-48-START-STOP-NO-RELOAD/test.sh deleted file mode 100755 index 0bece7d5b5..0000000000 --- a/test/TEST-48-START-STOP-NO-RELOAD/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -set -e - -TEST_DESCRIPTION="test StartStopNoReload" - -# shellcheck source=test/test-functions -. "${TEST_BASE_DIR:?}/test-functions" - -do_test "$@" diff --git a/test/units/testsuite-48.sh b/test/units/testsuite-23.start-stop-no-reload.sh index 2b5b86f6e8..9c4f17d7a2 100755 --- a/test/units/testsuite-48.sh +++ b/test/units/testsuite-23.start-stop-no-reload.sh @@ -3,44 +3,55 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh set -eux +set -o pipefail -cat >/run/systemd/system/testservice-48.target <<EOF +# Test start & stop operations without daemon-reload + +at_exit() { + set +e + + rm -f /run/systemd/system/testsuite-23-no-reload.{service,target} +} + +trap at_exit EXIT + +cat >/run/systemd/system/testsuite-23-no-reload.target <<EOF [Unit] -Wants=testservice-48.service +Wants=testsuite-23-no-reload.service EOF systemctl daemon-reload -systemctl start testservice-48.target +systemctl start testsuite-23-no-reload.target # The filesystem on the test image, despite being ext4, seems to have a mtime # granularity of one second, which means the manager's unit cache won't be # marked as dirty when writing the unit file, unless we wait at least a full # second after the previous daemon-reload. # May 07 23:12:20 H testsuite-48.sh[30]: + cat -# May 07 23:12:20 H testsuite-48.sh[30]: + ls -l --full-time /etc/systemd/system/testservice-48.service +# May 07 23:12:20 H testsuite-48.sh[30]: + ls -l --full-time /etc/systemd/system/testsuite-23-no-reload.service # May 07 23:12:20 H testsuite-48.sh[52]: -rw-r--r-- 1 root root 50 2020-05-07 23:12:20.000000000 +0100 / -# May 07 23:12:20 H testsuite-48.sh[30]: + stat -f --format=%t /etc/systemd/system/testservice-48.servic +# May 07 23:12:20 H testsuite-48.sh[30]: + stat -f --format=%t /etc/systemd/system/testsuite-23-no-reload.servic # May 07 23:12:20 H testsuite-48.sh[53]: ef53 sleep 3.1 -cat >/run/systemd/system/testservice-48.service <<EOF +cat >/run/systemd/system/testsuite-23-no-reload.service <<EOF [Service] ExecStart=/bin/sleep infinity EOF -systemctl start testservice-48.service +systemctl start testsuite-23-no-reload.service -systemctl is-active testservice-48.service +systemctl is-active testsuite-23-no-reload.service # Stop and remove, and try again to exercise https://github.com/systemd/systemd/issues/15992 -systemctl stop testservice-48.service -rm -f /run/systemd/system/testservice-48.service +systemctl stop testsuite-23-no-reload.service +rm -f /run/systemd/system/testsuite-23-no-reload.service systemctl daemon-reload sleep 3.1 -cat >/run/systemd/system/testservice-48.service <<EOF +cat >/run/systemd/system/testsuite-23-no-reload.service <<EOF [Service] ExecStart=/bin/sleep infinity EOF @@ -48,39 +59,35 @@ EOF # Start a non-existing unit first, so that the cache is reloaded for an unrelated # reason. Starting the existing unit later should still work thanks to the check # for the last load attempt vs cache timestamp. -systemctl start testservice-48-nonexistent.service || true +systemctl start testsuite-23-no-reload-nonexistent.service || true -systemctl start testservice-48.service +systemctl start testsuite-23-no-reload.service -systemctl is-active testservice-48.service +systemctl is-active testsuite-23-no-reload.service # Stop and remove, and try again to exercise the transaction setup code path by # having the target pull in the unloaded but available unit -systemctl stop testservice-48.service testservice-48.target -rm -f /run/systemd/system/testservice-48.service /run/systemd/system/testservice-48.target +systemctl stop testsuite-23-no-reload.service testsuite-23-no-reload.target +rm -f /run/systemd/system/testsuite-23-no-reload.service /run/systemd/system/testsuite-23-no-reload.target systemctl daemon-reload sleep 3.1 -cat >/run/systemd/system/testservice-48.target <<EOF +cat >/run/systemd/system/testsuite-23-no-reload.target <<EOF [Unit] Conflicts=shutdown.target -Wants=testservice-48.service +Wants=testsuite-23-no-reload.service EOF systemctl daemon-reload -systemctl start testservice-48.target +systemctl start testsuite-23-no-reload.target -cat >/run/systemd/system/testservice-48.service <<EOF +cat >/run/systemd/system/testsuite-23-no-reload.service <<EOF [Service] ExecStart=/bin/sleep infinity EOF -systemctl restart testservice-48.target - -systemctl is-active testservice-48.service - -echo OK >/testok +systemctl restart testsuite-23-no-reload.target -exit 0 +systemctl is-active testsuite-23-no-reload.service diff --git a/test/units/testsuite-48.service b/test/units/testsuite-48.service deleted file mode 100644 index 74769563e3..0000000000 --- a/test/units/testsuite-48.service +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -[Unit] -Description=TEST-48-START-STOP-NO-RELOAD - -[Service] -ExecStartPre=rm -f /failed /testok -ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh -Type=oneshot |