4
if [ -z "$1" ] || [ -z "$2" ]
6
echo "You have to pass a device serial and packagearchive link"
7
echo "$0 04bf2c50e294d599 http://host/path/to/archive.zip"
12
adb -s $ANDROID_SERIAL shell "$@"
15
exec_with_adb_user() {
16
adb -s $ANDROID_SERIAL shell sudo -i -u phablet bash -ic "$@"
21
zip_name=`basename $packagearchive`
27
mir_dir=$results_dir/mir
28
crash_dir=$results_dir/crash
29
log_dir=$results_dir/log
31
HOME_DIR="/home/phablet"
32
setup_dir="$HOME_DIR/mir-testrunner"
34
### Device initiation ###
36
echo "Rebooting the phone will take approximately $reboot_wait seconds to settle"
37
adb -s $ANDROID_SERIAL reboot
38
adb -s $ANDROID_SERIAL wait-for-device
43
adb -s $ANDROID_SERIAL pull /.dev_mode
44
if [[ ! -a .dev_mode ]]; then
45
exec_with_adb "touch /userdata/.writable_image"
46
echo "Rebooting the phone to set dev mode."
47
echo "It will take approximately $reboot_wait seconds to settle"
48
adb -s $ANDROID_SERIAL reboot
49
adb -s $ANDROID_SERIAL wait-for-device
51
exec_with_adb "touch /.dev_mode"
54
# Disable the intro screen
56
adb -s $ANDROID_SERIAL pull /.intro_off
57
if [[ ! -a .intro_off ]]; then
58
exec_with_adb "dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User32011 org.freedesktop.DBus.Properties.Set string:com.canonical.unity.AccountsService string:demo-edges variant:boolean:false"
60
exec_with_adb "touch /.intro_off"
61
exec_with_adb "cat /var/lib/AccountsService/users/phablet"
62
echo "Rebooting the phone to disable intro mode."
63
echo "It will take approximately $reboot_wait seconds to settle"
65
adb -s $ANDROID_SERIAL reboot
66
adb -s $ANDROID_SERIAL wait-for-device
74
rm -rf package_archive || true
81
exec_with_adb "rm -r $setup_dir $HOME_DIR/output"
82
exec_with_adb "rm /var/crash/*"
86
exec_with_adb_user "mkdir -p $setup_dir"
87
adb -s $ANDROID_SERIAL push mir_install_packages.sh "$setup_dir"
90
echo "Pausing $network_wait seconds before starting network"
92
exec_with_adb 'nmcli dev wifi connect ubuntu-qa-g-wpa-d password qalabwireless'
94
# Collect pre-setup info
95
adb -s $ANDROID_SERIAL pull /etc/media-info $log_dir
97
# Setup package archive
99
unzip $zip_name -d package_archive
100
if [ -d package_archive/output ]; then
101
ARCHIVE_DIR=package_archive/output
102
chmod 755 $ARCHIVE_DIR
103
elif [ -d package_archive/archive/work/output ]; then
104
ARCHIVE_DIR=package_archive/archive/work/output
105
chmod 755 $ARCHIVE_DIR
107
echo "E: Cannot find local package archive" >&2
110
adb -s $ANDROID_SERIAL push $ARCHIVE_DIR $HOME_DIR/archive
112
# Setup the PPAs and local Archive
113
ppa_repos="ppa_sources"
114
rm $ppa_repos || true
118
if echo $h | grep D09add_ppa; then
119
ppa=`echo $h | sed 's/D09add_ppa~\(.*\)~\(.*\)/ppa:\1\/\2/'`
120
echo ${ppa} >> ${ppa_repos}
124
local_archive="deb $local_archive_source/$local_archive_name $local_archive_pocket/ "
125
if echo $local_archive | grep "http"; then
126
local_archive=`sh -c "echo $local_archive | sed \"s/naartjie/10.98.3.7/\""`
127
echo ${local_archive} >> ${ppa_repos}
129
echo "Host side PPA repo list:"
131
adb -s $ANDROID_SERIAL push ${ppa_repos} /tmp/${ppa_repos}
133
# Add the test packages (these are the extra packages specified in the job cfg)
134
exec_with_adb "sudo apt-get -y --force-yes install $test_packages"
137
exec_with_adb "$setup_dir/mir_install_packages.sh"
140
# Collect pre-run logs
141
exec_with_adb "top -n 1 -b | head -20 > /tmp/top-pre.log"
142
adb -s $ANDROID_SERIAL pull /tmp/top-pre.log $log_dir
143
exec_with_adb "dpkg -l > /tmp/dpkg-l.log"
144
adb -s $ANDROID_SERIAL pull /tmp/dpkg-l.log $log_dir
147
# Setup to run the tests
148
rm .setup_complete || true
149
adb -s $ANDROID_SERIAL pull /.setup_complete
150
if [[ ! -a .setup_complete ]]; then
151
echo "SETUP FAILED - CAN'T CONTINUE"
154
# Connect to the unrestricted network for running tests
155
exec_with_adb 'nmcli dev wifi connect ubuntu-qa-g-wpa-d password qalabwireless'
157
# Execute all of the test suites
158
echo "I: Ready to run tests"
159
echo "Rebooting the phone will take approximately $reboot_wait seconds to settle"
160
adb -s $ANDROID_SERIAL reboot
161
adb -s $ANDROID_SERIAL wait-for-device
162
phablet-network --skip-setup -t 90s
164
echo "I: Turning on the display"
165
exec_with_adb "powerd-cli display on bright &"
167
echo "I: stopping unity8"
168
exec_with_adb_user "/sbin/initctl stop unity8"
169
echo "I: stopping lightdm"
170
exec_with_adb "/sbin/initctl stop lightdm"
172
adb -s $ANDROID_SERIAL wait-for-device
175
for suite in $test_suites; do
176
echo running suite $suite
177
if grep -q mir_demo_client_ <<< $suite ; then
178
if ! phablet-test-run -x -s $ANDROID_SERIAL $extra -v mir-demo-tester --mir-demo $suite /tmp/$suite-log ; then
183
if ! phablet-test-run -x -s $ANDROID_SERIAL $extra -v $suite ; then
190
adb -s $ANDROID_SERIAL wait-for-device
194
# Collect post-run logs
195
exec_with_adb "top -n 1 -b | head -20 > /tmp/top-post.log"
196
adb -s $ANDROID_SERIAL pull /tmp/top-post.log $log_dir
197
exec_with_adb "dmesg > /tmp/dmesg.log"
198
adb -s $ANDROID_SERIAL pull /tmp/dmesg.log $log_dir
200
for suite in $test_suites; do
201
adb pull /tmp/$suite-log $mir_dir || true
204
# Collect crash files
205
echo "I: Gathering crash files (if any)"
206
adb -s $ANDROID_SERIAL pull /var/crash $crash_dir
209
echo "I: Testing complete with returncode $mir_rc"