]>
Commit | Line | Data |
---|---|---|
d904afc7 LB |
1 | #!/usr/bin/env bash |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | set -ex | |
5 | ||
0ee99483 | 6 | cat >/run/systemd/system/testservice-48.target <<EOF |
d904afc7 LB |
7 | [Unit] |
8 | Wants=testservice-48.service | |
9 | EOF | |
10 | ||
11 | systemctl daemon-reload | |
12 | ||
13 | systemctl start testservice-48.target | |
14 | ||
15 | # The filesystem on the test image, despite being ext4, seems to have a mtime | |
16 | # granularity of one second, which means the manager's unit cache won't be | |
17 | # marked as dirty when writing the unit file, unless we wait at least a full | |
18 | # second after the previous daemon-reload. | |
19 | # May 07 23:12:20 systemd-testsuite testsuite-48.sh[30]: + cat | |
20 | # May 07 23:12:20 systemd-testsuite testsuite-48.sh[30]: + ls -l --full-time /etc/systemd/system/testservice-48.service | |
21 | # May 07 23:12:20 systemd-testsuite testsuite-48.sh[52]: -rw-r--r-- 1 root root 50 2020-05-07 23:12:20.000000000 +0100 / | |
22 | # May 07 23:12:20 systemd-testsuite testsuite-48.sh[30]: + stat -f --format=%t /etc/systemd/system/testservice-48.servic | |
23 | # May 07 23:12:20 systemd-testsuite testsuite-48.sh[53]: ef53 | |
7233e91a | 24 | sleep 3.1 |
d904afc7 | 25 | |
0ee99483 | 26 | cat >/run/systemd/system/testservice-48.service <<EOF |
d904afc7 LB |
27 | [Service] |
28 | ExecStart=/bin/sleep infinity | |
d904afc7 LB |
29 | EOF |
30 | ||
31 | systemctl start testservice-48.service | |
32 | ||
33 | systemctl is-active testservice-48.service | |
34 | ||
7233e91a LB |
35 | # Stop and remove, and try again to exercise https://github.com/systemd/systemd/issues/15992 |
36 | systemctl stop testservice-48.service | |
37 | rm -f /run/systemd/system/testservice-48.service | |
38 | systemctl daemon-reload | |
39 | ||
40 | sleep 3.1 | |
41 | ||
0ee99483 | 42 | cat >/run/systemd/system/testservice-48.service <<EOF |
7233e91a LB |
43 | [Service] |
44 | ExecStart=/bin/sleep infinity | |
45 | EOF | |
46 | ||
47 | # Start a non-existing unit first, so that the cache is reloaded for an unrelated | |
48 | # reason. Starting the existing unit later should still work thanks to the check | |
49 | # for the last load attempt vs cache timestamp. | |
50 | systemctl start testservice-48-nonexistent.service || true | |
51 | ||
52 | systemctl start testservice-48.service | |
53 | ||
54 | systemctl is-active testservice-48.service | |
55 | ||
cda66772 LB |
56 | # Stop and remove, and try again to exercise the transaction setup code path by |
57 | # having the target pull in the unloaded but available unit | |
58 | systemctl stop testservice-48.service testservice-48.target | |
59 | rm -f /run/systemd/system/testservice-48.service /run/systemd/system/testservice-48.target | |
60 | systemctl daemon-reload | |
61 | ||
62 | sleep 3.1 | |
63 | ||
0ee99483 | 64 | cat >/run/systemd/system/testservice-48.target <<EOF |
cda66772 LB |
65 | [Unit] |
66 | Conflicts=shutdown.target | |
67 | Wants=testservice-48.service | |
68 | EOF | |
69 | ||
70 | systemctl daemon-reload | |
71 | ||
72 | systemctl start testservice-48.target | |
73 | ||
0ee99483 | 74 | cat >/run/systemd/system/testservice-48.service <<EOF |
cda66772 LB |
75 | [Service] |
76 | ExecStart=/bin/sleep infinity | |
77 | EOF | |
78 | ||
79 | systemctl restart testservice-48.target | |
80 | ||
81 | systemctl is-active testservice-48.service | |
82 | ||
0ee99483 | 83 | echo OK >/testok |
d904afc7 LB |
84 | |
85 | exit 0 |