File: boot-smoke

package info (click to toggle)
systemd 232-25+deb9u11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 46,164 kB
  • sloc: ansic: 290,592; xml: 49,217; makefile: 5,503; sh: 4,031; python: 2,596; perl: 1,838
file content (65 lines) | stat: -rwxr-xr-x 1,820 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# test 20 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

. `dirname $0`/assert.sh

if [ -z "$ADT_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


    ADT_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 "checking for failed unmounts for user systemd"
    if journalctl | grep -E "systemd\[([2-9]|[1-9][0-9]+)\].*Failed unmounting"; then
        exit 1
    fi
    echo "checking for connection timeouts"
    if journalctl | grep "Connection timed out"; then
        exit 1
    fi

    echo "checking that polkitd runs"
    pidof polkitd

    echo "checking that there are no running jobs"
    TIMEOUT=10
    while [ $TIMEOUT -ge 0 ]; do
        running="$(systemctl --no-pager --no-legend list-jobs || true)"
        [ -n "$running" ] || break
        TIMEOUT=$((TIMEOUT - 1))
    done
    if [ -n "$running" ]; then
        echo "running jobs after remaining timeout $TIMEOUT: $running"
        journalctl --sync
        journalctl -ab > $ADT_ARTIFACTS/journal.txt
        udevadm info --export-db > $ADT_ARTIFACTS/udevdb.txt
        exit 1
    fi
fi

if [ "$ADT_REBOOT_MARK" -ge 5 ]; then
    exit 0
fi

echo "reboot #$ADT_REBOOT_MARK"
/tmp/autopkgtest-reboot $(($ADT_REBOOT_MARK + 1))