]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-23-TYPE-EXEC/testsuite.sh
4f7cc44310f4237a5faa1a2e6f9f9997a20ce917
[thirdparty/systemd.git] / test / TEST-23-TYPE-EXEC / testsuite.sh
1 #!/bin/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 set -o pipefail
6
7 systemd-analyze log-level debug
8 systemd-analyze log-target console
9
10 # Create a binary for which execve() will fail
11 touch /tmp/brokenbinary
12 chmod +x /tmp/brokenbinary
13
14 # These three commands should succeed.
15 systemd-run --unit=one -p Type=simple /bin/sleep infinity
16 systemd-run --unit=two -p Type=simple -p User=idontexist /bin/sleep infinity
17 systemd-run --unit=three -p Type=simple /tmp/brokenbinary
18
19 # And now, do the same with Type=exec, where the latter two should fail
20 systemd-run --unit=four -p Type=exec /bin/sleep infinity
21 ! systemd-run --unit=five -p Type=exec -p User=idontexist /bin/sleep infinity
22 ! systemd-run --unit=six -p Type=exec /tmp/brokenbinary
23
24 systemd-analyze log-level info
25
26 echo OK > /testok
27
28 exit 0