]>
Commit | Line | Data |
---|---|---|
d904afc7 | 1 | #!/usr/bin/env bash |
7b3cec95 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
d904afc7 LB |
3 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- |
4 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
084575ff | 5 | set -eux |
d904afc7 | 6 | |
0ee99483 | 7 | cat >/run/systemd/system/testservice-48.target <<EOF |
d904afc7 LB |
8 | [Unit] |
9 | Wants=testservice-48.service | |
10 | EOF | |
11 | ||
12 | systemctl daemon-reload | |
13 | ||
14 | systemctl start testservice-48.target | |
15 | ||
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. | |
ea0d33e2 ZJS |
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 | |
7233e91a | 25 | sleep 3.1 |
d904afc7 | 26 | |
0ee99483 | 27 | cat >/run/systemd/system/testservice-48.service <<EOF |
d904afc7 LB |
28 | [Service] |
29 | ExecStart=/bin/sleep infinity | |
d904afc7 LB |
30 | EOF |
31 | ||
32 | systemctl start testservice-48.service | |
33 | ||
34 | systemctl is-active testservice-48.service | |
35 | ||
7233e91a LB |
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 | |
40 | ||
41 | sleep 3.1 | |
42 | ||
0ee99483 | 43 | cat >/run/systemd/system/testservice-48.service <<EOF |
7233e91a LB |
44 | [Service] |
45 | ExecStart=/bin/sleep infinity | |
46 | EOF | |
47 | ||
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 | |
52 | ||
53 | systemctl start testservice-48.service | |
54 | ||
55 | systemctl is-active testservice-48.service | |
56 | ||
cda66772 LB |
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 | |
62 | ||
63 | sleep 3.1 | |
64 | ||
0ee99483 | 65 | cat >/run/systemd/system/testservice-48.target <<EOF |
cda66772 LB |
66 | [Unit] |
67 | Conflicts=shutdown.target | |
68 | Wants=testservice-48.service | |
69 | EOF | |
70 | ||
71 | systemctl daemon-reload | |
72 | ||
73 | systemctl start testservice-48.target | |
74 | ||
0ee99483 | 75 | cat >/run/systemd/system/testservice-48.service <<EOF |
cda66772 LB |
76 | [Service] |
77 | ExecStart=/bin/sleep infinity | |
78 | EOF | |
79 | ||
80 | systemctl restart testservice-48.target | |
81 | ||
82 | systemctl is-active testservice-48.service | |
83 | ||
0ee99483 | 84 | echo OK >/testok |
d904afc7 LB |
85 | |
86 | exit 0 |