summaryrefslogtreecommitdiffstats
path: root/debian/tests/boot-smoke
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:19 +0000
commitb7e8d5af06ee840cc48217ca4629cf28aeeb3c50 (patch)
tree6aa8dc840b085de50db46e2ad0725eae248fef02 /debian/tests/boot-smoke
parentAdding upstream version 252.22. (diff)
downloadsystemd-debian/252.22-1_deb12u1.tar.xz
systemd-debian/252.22-1_deb12u1.zip
Adding debian version 252.22-1~deb12u1.debian/252.22-1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/boot-smoke95
1 files changed, 95 insertions, 0 deletions
diff --git a/debian/tests/boot-smoke b/debian/tests/boot-smoke
new file mode 100755
index 0000000..d4105fc
--- /dev/null
+++ b/debian/tests/boot-smoke
@@ -0,0 +1,95 @@
+#!/bin/sh
+# test $TEST_REBOOTS successful reboots in a row
+# Author: Martin Pitt <martin.pitt@ubuntu.com>
+# For bisecting/testing you can replace individual binaries in /lib/systemd
+# with --copy /host/path/systemd-foo:/tmp/systemd-replace/systemd-foo
+set -e
+
+IS_SYSTEM_RUNNING_TIMEOUT=300
+TEST_REBOOTS=5
+
+. `dirname $0`/assert.sh
+
+fail() {
+ [ -n "$1" ] && echo "$1"
+ set +e
+ journalctl --sync
+ journalctl -a > "$AUTOPKGTEST_ARTIFACTS/boot-smoke-journal.txt"
+ systemctl --no-pager --no-legend list-jobs > "$AUTOPKGTEST_ARTIFACTS/boot-smoke-running-jobs.txt"
+ udevadm info --export-db > "$AUTOPKGTEST_ARTIFACTS/boot-smoke-udevdb.txt"
+ exit 1
+}
+
+if [ -z "$AUTOPKGTEST_REBOOT_MARK" ]; then
+ # enable persistent journal
+ mkdir -p /var/log/journal
+ # allow X to start even on headless machines
+ mkdir -p /etc/X11/xorg.conf.d/
+ cat << EOF > /etc/X11/xorg.conf.d/dummy.conf
+Section "Device"
+ Identifier "test"
+ Driver "dummy"
+EndSection
+EOF
+
+ # This test installs network-manager, which seems to cause
+ # systemd-networkd-wait-online to be stuck as they conflict,
+ # so systemctl start network-online.target ran by autopkgtest
+ # gets stuck, at least in Debian Bullseye images.
+ # https://salsa.debian.org/ci-team/autopkgtest/-/blob/debian/5.21/virt/autopkgtest-virt-lxc#L131
+ systemctl disable systemd-networkd.service
+
+ AUTOPKGTEST_REBOOT_MARK=0
+ if [ -d /tmp/systemd-replace/ ]; then
+ for f in /tmp/systemd-replace/*; do
+ echo "Installing $f..."
+ rm -f /lib/systemd/$(basename $f)
+ cp $f /lib/systemd/
+ done
+ fi
+else
+ echo "waiting to boot..."
+ TIMEOUT=${IS_SYSTEM_RUNNING_TIMEOUT}
+ while [ $TIMEOUT -ge 0 ]; do
+ state="$(systemctl is-system-running || true)"
+ case $state in
+ running|degraded)
+ break
+ ;;
+ *)
+ sleep 1
+ TIMEOUT=$((TIMEOUT - 1))
+ ;;
+ esac
+ done
+
+ echo "checking for running system"
+ if [ "$state" = "degraded" ]; then
+ systemctl --no-pager --no-legend --failed list-units > "$AUTOPKGTEST_ARTIFACTS/boot-smoke-failed-units.txt" || true
+ echo "systemctl is-system-running: degraded (non-fatal)"
+ elif [ "$state" != "running" ]; then
+ fail "system not running after timeout $IS_SYSTEM_RUNNING_TIMEOUT, state: $state"
+ fi
+
+ echo "checking for failed unmounts for user systemd"
+ # grep complete journal to catch shutdown messages
+ if journalctl | grep -E "systemd\[([2-9]|[1-9][0-9]+)\].*Failed unmounting"; then
+ fail "found failed unmount in journal"
+ fi
+
+ # grep only this boot's journal, earlier ones complain about missing "render" group
+ echo "checking for connection timeouts"
+ if journalctl -b | grep "Connection timed out"; then
+ fail "found connection timeout in journal for this boot"
+ fi
+
+ echo "checking that NetworkManager runs"
+ pidof NetworkManager || fail "NetworkManager was not running"
+fi
+
+if [ "$AUTOPKGTEST_REBOOT_MARK" -ge "$TEST_REBOOTS" ]; then
+ exit 0
+fi
+
+echo "reboot #$AUTOPKGTEST_REBOOT_MARK"
+/tmp/autopkgtest-reboot $(($AUTOPKGTEST_REBOOT_MARK + 1))