hwdb: fix screen rotation for EXO Wings 2in1 w1125 (#36283)
[systemd.io.git] / test / units / TEST-23-UNIT-FILE.success-failure.sh
blob8fc9596cc57e6a8531aee3b4c49705ccaa82778f
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -eux
4 set -o pipefail
6 # Test OnSuccess=/OnFailure= in combination
8 systemd-analyze log-level debug
10 # Start-up should fail, but the automatic restart should fix it
11 (! systemctl start success-failure-test )
13 # Wait until the first invocation finished & failed
14 while test ! -f /tmp/success-failure-test-ran ; do
15 sleep .5
16 done
18 # Wait until the second invocation finished & succeeded
19 while test ! -f /tmp/success-failure-test-ran2 ; do
20 sleep .5
21 done
23 # Verify it is indeed running
24 systemctl is-active -q success-failure-test
26 # The above should have caused the failure service to start (asynchronously)
27 while test "$(systemctl is-active success-failure-test-failure)" != "active" ; do
28 sleep .5
29 done
31 # But the success service should not have started
32 test "$(systemctl is-active success-failure-test-success)" = "inactive"
34 systemctl stop success-failure-test-failure
36 # Do a clean kill of the service now
37 systemctl kill success-failure-test
39 # This should result in the success service to start
40 while test "$(systemctl is-active success-failure-test-success)" != "active" ; do
41 sleep .5
42 done
44 # But the failure service should not have started again
45 test "$(systemctl is-active success-failure-test-failure)" = "inactive"
47 systemctl stop success-failure-test success-failure-test-success
49 systemd-analyze log-level info