2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4 # ex: ts=8 sw=4 sts=4 et filetype=sh
7 cat >/run
/systemd
/system
/testservice-48.target
<<EOF
9 Wants=testservice-48.service
12 systemctl daemon-reload
14 systemctl start testservice-48.target
16 # The filesystem on the test image, despite being ext4, seems to have a mtime
17 # granularity of one second, which means the manager's unit cache won't be
18 # marked as dirty when writing the unit file, unless we wait at least a full
19 # second after the previous daemon-reload.
20 # May 07 23:12:20 H testsuite-48.sh[30]: + cat
21 # May 07 23:12:20 H testsuite-48.sh[30]: + ls -l --full-time /etc/systemd/system/testservice-48.service
22 # 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 /
23 # May 07 23:12:20 H testsuite-48.sh[30]: + stat -f --format=%t /etc/systemd/system/testservice-48.servic
24 # May 07 23:12:20 H testsuite-48.sh[53]: ef53
27 cat >/run
/systemd
/system
/testservice-48.service
<<EOF
29 ExecStart=/bin/sleep infinity
32 systemctl start testservice-48.service
34 systemctl is-active testservice-48.service
36 # Stop and remove, and try again to exercise https://github.com/systemd/systemd/issues/15992
37 systemctl stop testservice-48.service
38 rm -f /run
/systemd
/system
/testservice-48.service
39 systemctl daemon-reload
43 cat >/run
/systemd
/system
/testservice-48.service
<<EOF
45 ExecStart=/bin/sleep infinity
48 # Start a non-existing unit first, so that the cache is reloaded for an unrelated
49 # reason. Starting the existing unit later should still work thanks to the check
50 # for the last load attempt vs cache timestamp.
51 systemctl start testservice-48-nonexistent.service || true
53 systemctl start testservice-48.service
55 systemctl is-active testservice-48.service
57 # Stop and remove, and try again to exercise the transaction setup code path by
58 # having the target pull in the unloaded but available unit
59 systemctl stop testservice-48.service testservice-48.target
60 rm -f /run
/systemd
/system
/testservice-48.service
/run
/systemd
/system
/testservice-48.target
61 systemctl daemon-reload
65 cat >/run
/systemd
/system
/testservice-48.target
<<EOF
67 Conflicts=shutdown.target
68 Wants=testservice-48.service
71 systemctl daemon-reload
73 systemctl start testservice-48.target
75 cat >/run
/systemd
/system
/testservice-48.service
<<EOF
77 ExecStart=/bin/sleep infinity
80 systemctl restart testservice-48.target
82 systemctl is-active testservice-48.service