hwdb: fix screen rotation for EXO Wings 2in1 w1125 (#36283)
[systemd.io.git] / test / units / TEST-01-BASIC.sh
blobbb3ff2f1e9e5ce9919d26ee8e792a0cb836a557a
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -eux
4 set -o pipefail
6 # Check if the colored --version output behaves correctly
7 SYSTEMD_COLORS=256 systemctl --version
9 # Check if we properly differentiate between a full systemd setup and a "light"
10 # version of it that's done during daemon-reexec
12 # See: https://github.com/systemd/systemd/issues/27106
13 if systemd-detect-virt -q --container; then
14 # We initialize /run/systemd/container only during a full setup
15 test -e /run/systemd/container
16 cp -afv /run/systemd/container /tmp/container
17 rm -fv /run/systemd/container
18 systemctl daemon-reexec
19 test ! -e /run/systemd/container
20 cp -afv /tmp/container /run/systemd/container
21 else
22 # We bring the loopback netdev up only during a full setup, so it should
23 # not get brought back up during reexec if we disable it beforehand
24 [[ "$(ip -o link show lo)" =~ LOOPBACK,UP ]]
25 ip link set lo down
26 [[ "$(ip -o link show lo)" =~ state\ DOWN ]]
27 systemctl daemon-reexec
28 [[ "$(ip -o link show lo)" =~ state\ DOWN ]]
29 ip link set lo up
31 # We also disable coredumps only during a full setup
32 sysctl -w kernel.core_pattern=dont-overwrite-me
33 systemctl daemon-reexec
34 diff <(echo dont-overwrite-me) <(sysctl --values kernel.core_pattern)
37 # Collect failed units & do one daemon-reload to a basic sanity check
38 systemctl --state=failed --no-legend --no-pager | tee /failed
39 test ! -s /failed
40 systemctl daemon-reload
42 # Check that the early setup is actually skipped on reexec.
43 # If the early setup is done more than once, then several timestamps,
44 # e.g. SecurityStartTimestamp, are re-initialized, and causes an ABRT
45 # of systemd-analyze blame. See issue #27187.
46 systemd-analyze blame
48 # Test for 'systemd-update-utmp runlevel' vs 'systemctl daemon-reexec'.
49 # See issue #27163.
50 # shellcheck disable=SC2034
51 if [[ -x /usr/lib/systemd/systemd-update-utmp ]]; then
52 for _ in {0..10}; do
53 systemctl daemon-reexec &
54 pid_reexec=$!
55 # shellcheck disable=SC2034
56 for _ in {0..10}; do
57 SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-update-utmp runlevel
58 done
59 wait "$pid_reexec"
60 done
63 touch /testok