summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@canonical.com>2020-10-07 16:28:49 -0400
committerDan Streetman <ddstreet@canonical.com>2020-10-10 11:40:10 -0400
commit9fd8391c2499e163515b629a8ca5790898fc599d (patch)
tree959e36813e9190daec5232839a98a08fb93d95ff
parent2875e456fe88e43436cc3ea9763ea107597a313d (diff)
update d/t/boot-smoke for LP: #1892358
-rwxr-xr-xdebian/tests/boot-smoke84
1 files changed, 35 insertions, 49 deletions
diff --git a/debian/tests/boot-smoke b/debian/tests/boot-smoke
index 784b6e39f2..ebd95326ae 100755
--- a/debian/tests/boot-smoke
+++ b/debian/tests/boot-smoke
@@ -1,17 +1,26 @@
#!/bin/sh
-# test 20 successful reboots in a row
+# 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
-RUNNING_TIMEOUT=35
-JOBS_TIMEOUT=35
-REBOOTS=5
+IS_SYSTEM_RUNNING_TIMEOUT=300
+TEST_REBOOTS=5
. `dirname $0`/assert.sh
-if [ -z "$ADT_REBOOT_MARK" ]; then
+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
@@ -24,7 +33,7 @@ EndSection
EOF
- ADT_REBOOT_MARK=0
+ AUTOPKGTEST_REBOOT_MARK=0
if [ -d /tmp/systemd-replace/ ]; then
for f in /tmp/systemd-replace/*; do
echo "Installing $f..."
@@ -33,10 +42,8 @@ EOF
done
fi
else
- ret=0
-
echo "waiting to boot..."
- TIMEOUT=$RUNNING_TIMEOUT
+ TIMEOUT=${IS_SYSTEM_RUNNING_TIMEOUT}
while [ $TIMEOUT -ge 0 ]; do
state="$(systemctl is-system-running || true)"
case $state in
@@ -50,54 +57,33 @@ else
esac
done
- echo "checking for failed unmounts for user systemd"
- JOURNAL=$(journalctl)
- if echo "$JOURNAL" | grep -E "systemd\[([2-9]|[1-9][0-9]+)\].*Failed unmounting"; then
- ret=1
- fi
- echo "checking for connection timeouts (non fatal)"
- if echo "$JOURNAL" | grep "Connection timed out"; then
- # systemd-udevd started to time out resolving group 'colord'
- # yet, not reproducible locally, investigating
- ret=0
- fi
-
- echo "checking that polkitd runs"
- if ! pidof polkitd; then
- echo "polkitd is NOT running"
- ret=1
+ 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 failed jobs (non fatal)"
- if [ "$state" != "running" ]; then
- echo "systemctl is-system-running returns: $state"
- systemctl --no-pager --no-legend list-jobs > $ADT_ARTIFACTS/running-jobs.txt || true
+ 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
- echo "checking that there are no running jobs"
- TIMEOUT=$JOBS_TIMEOUT
- while [ $TIMEOUT -ge 0 ]; do
- running="$(systemctl --no-pager --no-legend list-jobs || true)"
- [ -n "$running" ] || break
- sleep 1
- TIMEOUT=$((TIMEOUT - 1))
- done
- if [ -n "$running" ]; then
- echo "running jobs after remaining timeout $JOBS_TIMEOUT: $running"
- journalctl --sync
- journalctl -ab > $ADT_ARTIFACTS/journal.txt
- udevadm info --export-db > $ADT_ARTIFACTS/udevdb.txt
- ret=1
+ # 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
- if [ "$ret" != "0" ]; then
- exit $ret
- fi
+ echo "checking that NetworkManager runs"
+ pidof NetworkManager || fail "NetworkManager was not running"
fi
-if [ "$ADT_REBOOT_MARK" -ge "$REBOOTS" ]; then
+if [ "$AUTOPKGTEST_REBOOT_MARK" -ge "$TEST_REBOOTS" ]; then
exit 0
fi
-echo "reboot #$ADT_REBOOT_MARK"
-/tmp/autopkgtest-reboot $(($ADT_REBOOT_MARK + 1))
+echo "reboot #$AUTOPKGTEST_REBOOT_MARK"
+/tmp/autopkgtest-reboot $(($AUTOPKGTEST_REBOOT_MARK + 1))