diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-06-20 18:39:52 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-06-20 20:51:12 +0200 |
commit | 4b89c55c3f79c799e96b76fdcf4269fb5559121e (patch) | |
tree | 89fe1679dab4935ea2e91af98eb057e694e51d9f /test/units/TEST-80-NOTIFYACCESS.sh | |
parent | busctl: send BUSERROR= to caller via sd_notify() protocol (diff) | |
download | systemd-4b89c55c3f79c799e96b76fdcf4269fb5559121e.tar.xz systemd-4b89c55c3f79c799e96b76fdcf4269fb5559121e.zip |
TEST-80-NOTIFYACCESS: introduce test for ERRNO= + BUS/VARLINKERROR=
Diffstat (limited to 'test/units/TEST-80-NOTIFYACCESS.sh')
-rwxr-xr-x | test/units/TEST-80-NOTIFYACCESS.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/units/TEST-80-NOTIFYACCESS.sh b/test/units/TEST-80-NOTIFYACCESS.sh index 97b222a9e8..355f6e7e30 100755 --- a/test/units/TEST-80-NOTIFYACCESS.sh +++ b/test/units/TEST-80-NOTIFYACCESS.sh @@ -20,6 +20,8 @@ sync_out() { export SYSTEMD_LOG_LEVEL=debug +# Test NotifyAccess= override through sd_notify() + systemctl --no-block start notify.service sync_in a @@ -38,6 +40,22 @@ sync_out d sync_in e systemctl --quiet is-active notify.service +[[ "$(systemctl show notify.service -P StatusText)" != BOGUS* ]] + +assert_eq "$(systemctl show notify.service -P StatusErrno)" "1" +assert_eq "$(systemctl show notify.service -P StatusBusError)" "org.freedesktop.DBus.Error.InvalidArgs" +assert_eq "$(systemctl show notify.service -P StatusVarlinkError)" "org.varlink.service.InvalidParameter" + +sync_out f +sync_in g + +assert_eq "$(systemctl show notify.service -P StatusErrno)" "1" +assert_eq "$(systemctl show notify.service -P StatusBusError)" "org.freedesktop.DBus.Error.InvalidArgs" +assert_eq "$(systemctl show notify.service -P StatusVarlinkError)" "org.varlink.service.InvalidParameter" + +sync_out h +sync_in i + assert_eq "$(systemctl show notify.service -p StatusText --value)" "OK" assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "none" @@ -46,6 +64,12 @@ assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "all" rm /tmp/syncfifo1 /tmp/syncfifo2 +# Explicitly test busctl's BUSERROR= reporting and systemctl status should show it + +(! systemd-run --wait --unit="TEST-80-BUSERROR.service" -p NotifyAccess=main busctl introspect org.freedesktop.systemd1 /bogus/001) +assert_eq "$(systemctl show TEST-80-BUSERROR.service -P StatusBusError)" "org.freedesktop.DBus.Error.UnknownObject" +assert_in "D-Bus: org.freedesktop.DBus.Error.UnknownObject" "$(systemctl status TEST-80-BUSERROR.service)" + # Now test basic fdstore behaviour MYSCRIPT="/tmp/myscript$RANDOM.sh" |