--- /dev/null
+../TEST-01-BASIC/Makefile
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -e
+
+TEST_DESCRIPTION="test NotifyAccess through sd-notify"
+TEST_NO_QEMU=1
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
+do_test "$@"
install_subdir('testsuite-63.units',
exclude_files : '.gitattributes',
install_dir : testdata_dir)
+ install_subdir('testsuite-80.units',
+ exclude_files : '.gitattributes',
+ install_dir : testdata_dir)
install_data(kbd_model_map,
install_dir : testdata_dir + '/test-keymap-util')
--- /dev/null
+[Service]
+Type=notify
+NotifyAccess=all
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-80.units/test.sh
--- /dev/null
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# shellcheck disable=SC2016
+set -eux
+set -o pipefail
+
+systemd-notify --status="Test starts, waiting for 5 seconds"
+sleep 5
+
+(
+ systemd-notify --pid=auto
+ systemd-notify "NOTIFYACCESS=main"
+
+ systemd-notify --status="Sending READY=1 in an unpriviledged process"
+ (
+ sleep 0.1
+ systemd-notify --ready
+ )
+ sleep 10
+
+ systemd-notify "MAINPID=$$"
+)
+
+systemd-notify --ready --status="OK"
+systemd-notify "NOTIFYACCESS=none"
+sleep infinity
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=TEST-80-NOTIFYACCESS
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
--- /dev/null
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# shellcheck disable=SC2016
+set -eux
+set -o pipefail
+
+# shellcheck source=test/units/assert.sh
+. "$(dirname "$0")"/assert.sh
+
+: >/failed
+
+systemctl --no-block start notify.service
+sleep 2
+
+assert_eq "$(systemctl show notify.service -p StatusText --value)" "Test starts, waiting for 5 seconds"
+assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "all"
+sleep 5
+
+assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "main"
+assert_eq "$(systemctl show notify.service -p StatusText --value)" "Sending READY=1 in an unpriviledged process"
+assert_rc 3 systemctl --quiet is-active notify.service
+sleep 10
+
+systemctl --quiet is-active notify.service
+assert_eq "$(systemctl show notify.service -p StatusText --value)" "OK"
+assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "none"
+
+systemctl stop notify.service
+assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "all"
+
+touch /testok
+rm /failed