hwdb: fix screen rotation for EXO Wings 2in1 w1125 (#36283)
[systemd.io.git] / test / units / TEST-19-CGROUP.cleanup-slice.sh
blob5d63160334cb2705214e59a7f366590e21700d64
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -eux
4 set -o pipefail
6 # shellcheck source=test/units/util.sh
7 . "$(dirname "$0")"/util.sh
9 export SYSTEMD_LOG_LEVEL=debug
11 # Create service with KillMode=none inside a slice
12 cat <<EOF >/run/systemd/system/test19cleanup.service
13 [Unit]
14 Description=Test 19 cleanup Service
15 [Service]
16 Slice=test19cleanup.slice
17 Type=exec
18 ExecStart=sleep infinity
19 KillMode=none
20 EOF
21 cat <<EOF >/run/systemd/system/test19cleanup.slice
22 [Unit]
23 Description=Test 19 cleanup Slice
24 EOF
26 # Start service
27 systemctl start test19cleanup.service
28 assert_rc 0 systemd-cgls /test19cleanup.slice
30 pid=$(systemctl show --property MainPID --value test19cleanup)
31 ps "$pid"
33 # Stop slice
34 # The sleep process will not be killed because of KillMode=none
35 # Since there is still a process running under it, the /test19cleanup.slice cgroup won't be removed
36 systemctl stop test19cleanup.slice
38 ps "$pid"
40 # Kill sleep process manually
41 kill -s TERM "$pid"
42 while kill -0 "$pid" 2>/dev/null; do sleep 0.1; done
44 timeout 30 bash -c 'while systemd-cgls /test19cleanup.slice/test19cleanup.service >& /dev/null; do sleep .5; done'
45 assert_rc 1 systemd-cgls /test19cleanup.slice/test19cleanup.service
47 # Check that empty cgroup /test19cleanup.slice has been removed
48 timeout 30 bash -c 'while systemd-cgls /test19cleanup.slice >& /dev/null; do sleep .5; done'
49 assert_rc 1 systemd-cgls /test19cleanup.slice