1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00
systemd-stable/test/units/testsuite-23.sh

35 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2018-07-17 13:35:12 +03:00
set -ex
set -o pipefail
2019-04-03 09:19:08 +03:00
systemd-analyze log-level debug
systemd-analyze log-target console
2018-07-17 13:35:12 +03:00
# Create a binary for which execve() will fail
touch /tmp/brokenbinary
chmod +x /tmp/brokenbinary
# These three commands should succeed.
systemd-run --unit=one -p Type=simple /bin/sleep infinity
systemd-run --unit=two -p Type=simple -p User=idontexist /bin/sleep infinity
systemd-run --unit=three -p Type=simple /tmp/brokenbinary
# And now, do the same with Type=exec, where the latter two should fail
systemd-run --unit=four -p Type=exec /bin/sleep infinity
! systemd-run --unit=five -p Type=exec -p User=idontexist /bin/sleep infinity
! systemd-run --unit=six -p Type=exec /tmp/brokenbinary
systemd-run --unit=seven -p KillSignal=SIGTERM -p RestartKillSignal=SIGINT -p Type=exec /bin/sleep infinity
# Both TERM and SIGINT happen to have the same number on all architectures
test $(systemctl show --value -p KillSignal seven.service) -eq 15
test $(systemctl show --value -p RestartKillSignal seven.service) -eq 2
systemctl restart seven.service
systemctl stop seven.service
2019-04-03 09:19:08 +03:00
systemd-analyze log-level info
2018-07-17 13:35:12 +03:00
echo OK > /testok
exit 0