~fginther/+junk/fix-install-failure-hang

« back to all changes in this revision

Viewing changes to medium-tests-generic/target-override/usr/local/bin/run-autopilot.sh

  • Committer: Christopher Lee
  • Date: 2013-09-03 02:51:56 UTC
  • Revision ID: chris.lee@canonical.com-20130903025156-rm89295l0gzzz5q4
Remove debugging commands, slight cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
#
4
4
# This script installs the provided debs and runs the provided autopilot test suite.
5
 
# It is based off the example scripts that come with Otto 
 
5
# It is based off the example scripts that come with Otto
6
6
 
7
7
# Copyright © 2013 Canonical Ltd.
8
8
# Author: Jean-baptiste Lallement <jean-baptiste.lallement@canonical.com>
30
30
AP_LOGFILE=$TESTBASE/autopilot.log
31
31
AP_OPTS="-v -r -rd $AP_ARTIFACTS -f xml"
32
32
 
33
 
DEB_SOURCE_DIR=$TESTBASE/debs
34
 
 
35
 
setup_environment() {
36
 
        # Need to be able to connect to the dbus session.
37
 
        dbus_session_file=/home/$USER/.dbus/session-bus/$(cat /var/lib/dbus/machine-id)-0
38
 
        #echo "Looking for dbus session: ${dbus_session_file}"
39
 
        #if [ -e "$dbus_session_file" ]; then
40
 
        #       . "$dbus_session_file"
41
 
        #       export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
42
 
        #else
43
 
        #       echo "File doesn't exist."
44
 
        #fi 
45
 
        ps aux
46
 
        dbus_pid=$(ps x | grep "dbus-daemon --session" | grep -v grep | awk '{print $1}')
47
 
        export $(</proc/$dbus_pid/environ tr \\0 \\n | grep -E '^DBUS_SESSION_BUS_ADDRESS=')
48
 
}
 
33
DEB_SOURCE_DIR=/var/local/autopilot-install-local/debs
49
34
 
50
35
install_debs() {
51
 
        sudo touch $TESTBASE/install_debs.txt
52
36
        if [ -e ${DEB_SOURCE_DIR} ]; then
53
 
                # Taken from generic-medium-tests, resolves any dependencies.
 
37
                # Taken from generic-medium-tests, using apt-get resolves any
 
38
                # dependencies.
54
39
                package_list=""
55
40
                for i in `ls ${DEB_SOURCE_DIR}/*.deb`; do
56
41
                  package_name=`dpkg -I $i | grep Package | cut -d " " -f 3`
63
48
}
64
49
 
65
50
setup_tests() {
66
 
        env
67
 
        sudo touch $TESTBASE/setup_tests.txt
68
51
        # Only required while we're using unity as a desktop
69
52
    # Disable notifications and screensaver
70
53
    gsettings set com.ubuntu.update-notifier show-apport-crashes false
73
56
        # Workaround for autopilot crashing when parsing debug output
74
57
        export LANG=C
75
58
 
76
 
        # Autopilot needs write access on /dev/uinput to create /dev/autoilot-uinput. To prevent that file from being read-only after a reboot, make both of them writeable
 
59
        # Autopilot needs write access on /dev/uinput to create
 
60
        # /dev/autoilot-uinput. To prevent that file from being read-only after a
 
61
        # reboot, make both of them writeable
77
62
        sudo chmod 666 /dev/autopilot-uinput || true
78
63
        sudo chmod 666 /dev/uinput || true
79
64
 
80
 
    # Loads the list of test and queue them in test spool
81
65
    sudo mkdir -p $AP_ARTIFACTS $AP_RESULTS
82
66
    sudo chown $USER:$USER $TESTBASE $AP_ARTIFACTS $AP_RESULTS
83
67
}
84
68
 
 
69
# Similar to what happens in the current generic-mediumtests for logging.
 
70
log_details() {
 
71
    echo "Logging running details"
 
72
    apt-cache policy libautopilot-qt python-autopilot libxpathselect1.3
 
73
    xrandr
 
74
}
 
75
 
85
76
# Expects each test suite per line in the file.
86
77
run_tests() {
87
 
        sudo touch $TESTBASE/run_tests.txt
88
78
    if [ ! -e $AP_TESTSUITES ]; then
89
79
        echo "E: '$AP_TESTSUITES does not exist. Exiting!"
90
80
        exit 1
92
82
 
93
83
        while read suite; do
94
84
                echo "I: Running ${suite}"
95
 
        set +e  
 
85
        set +e
96
86
        autopilot run $suite $AP_OPTS -o $AP_RESULTS/$suite.xml 2>&1|tee $AP_LOGFILE
97
87
        AP_RC=$?
98
88
        set -e
99
89
        done < $AP_TESTSUITES
100
90
 
101
91
        echo "I: No test left to run"
102
 
        sudo shutdown -h +10
 
92
        sudo shutdown -h +1
103
93
}
104
94
 
105
 
# setup_environment
106
95
install_debs
107
96
setup_tests
 
97
log_details
108
98
run_tests