diff options
author | Luca Boccassi <bluca@debian.org> | 2022-08-02 21:07:35 +0200 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2022-08-23 21:38:08 +0200 |
commit | 4c420328549ed98c6ca170d8ccc89cbee2f38ccc (patch) | |
tree | 2fffd3d5c7e3c6e99b24cc55f031c69eab24ac76 /test/units | |
parent | core: add basic infrastructure to record unit activation information (diff) | |
download | systemd-4c420328549ed98c6ca170d8ccc89cbee2f38ccc.tar.xz systemd-4c420328549ed98c6ca170d8ccc89cbee2f38ccc.zip |
service: set TRIGGER_UNIT= and TRIGGER_PATH= on activation by path unit
When a service is triggered by a path unit, pass the
path unit name and the path that triggered it via env vars
to the spawned processes.
Note that this is best-effort, as there might be many triggers
at the same time, but we only get woken up by one.
Diffstat (limited to 'test/units')
-rwxr-xr-x | test/units/testsuite-63.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/units/testsuite-63.sh b/test/units/testsuite-63.sh index 20d93936b3..7ee7fc1513 100755 --- a/test/units/testsuite-63.sh +++ b/test/units/testsuite-63.sh @@ -28,6 +28,19 @@ test "$(systemctl show test63.service -P Result)" = success test "$(systemctl show test63.path -P ActiveState)" = active test "$(systemctl show test63.path -P Result)" = success +# Test that glob matching works too, with $TRIGGER_PATH +systemctl start test63-glob.path +touch /tmp/test63-glob-foo +timeout 60 bash -c 'while ! systemctl -q is-active test63-glob.service; do sleep .2; done' +test "$(systemctl show test63-glob.service -P ActiveState)" = active +test "$(systemctl show test63-glob.service -P Result)" = success + +test "$(busctl --json=short get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/test63_2dglob_2eservice org.freedesktop.systemd1.Unit ActivationDetails)" = '{"type":"a(ss)","data":[["trigger_unit","test63-glob.path"],["trigger_path","/tmp/test63-glob-foo"]]}' + +systemctl stop test63-glob.path test63-glob.service + +test "$(busctl --json=short get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/test63_2dglob_2eservice org.freedesktop.systemd1.Unit ActivationDetails)" = '{"type":"a(ss)","data":[]}' + systemctl log-level info echo OK >/testok |