39
by Alan Pope
add test_non_starters.sh initial version - don't laugh |
1 |
#!/bin/bash
|
2 |
#
|
|
3 |
# * Installs click packages in $CLICKS
|
|
4 |
# * Runs each app in turn
|
|
5 |
# * Takes screenshot of each app
|
|
6 |
# * Looks for all-white and all-black screenshots and moves to issues folder
|
|
7 |
#
|
|
8 |
# Requirements
|
|
9 |
#
|
|
10 |
# * Device already flashed with Ubuntu for Phones
|
|
11 |
# * Network connection on device enabled
|
|
12 |
# * Subdirectory of where this script is, containing click packages to test
|
|
13 |
#
|
|
14 |
# ToDo
|
|
15 |
# * Check internet access (cause of webapp fails)
|
|
16 |
# * Supress OSK between runs
|
|
17 |
||
18 |
TARGETUSER="phablet" |
|
19 |
TARGET="/home/$TARGETUSER" |
|
20 |
CLICKS="clicks/" |
|
21 |
DATESTAMP=`date +%Y%m%d`-`date +%H%M%S` |
|
22 |
LOGDIR=`pwd`/$DATESTAMP |
|
23 |
FBDEV=fb0 |
|
24 |
CONVERTOPTS="-alpha off -depth 8 -size 768x1280" |
|
25 |
||
26 |
function pause { |
|
27 |
echo ":: Wait $1" |
|
28 |
sleep $1
|
|
29 |
}
|
|
30 |
||
31 |
function wait_for_device { |
|
32 |
echo -n ":: Waiting for device to come back ." |
|
33 |
STATE="unknown" |
|
34 |
while [ "$STATE" == "unknown" ]; |
|
35 |
do
|
|
36 |
echo -n "." |
|
37 |
STATE=`adb get-state` |
|
38 |
sleep 15
|
|
39 |
done
|
|
40 |
echo " " |
|
41 |
}
|
|
42 |
||
43 |
function screen_grab { |
|
44 |
adb shell "kill -SIGSTOP \$(pidof unity8)"
|
|
45 |
adb pull /dev/$FBDEV $LOGDIR/fb |
|
46 |
adb shell "kill -SIGCONT \$(pidof unity8)"
|
|
47 |
convert $CONVERTOPTS rgba:$LOGDIR/fb[0] $LOGDIR/$LAUNCH.png |
|
48 |
}
|
|
49 |
||
50 |
mkdir -p $LOGDIR/issues
|
|
51 |
||
52 |
adb shell system-image-cli -i 2>&1 | tee -a $LOGDIR/info.log |
|
53 |
adb push $CLICKS $TARGET/$CLICKS 2>&1 | tee -a $LOGDIR/push.log |
|
54 |
for PACKAGE in $(ls $CLICKS) |
|
55 |
do
|
|
56 |
adb shell click install --force-missing-framework --user=phablet $TARGET/$CLICKS/$PACKAGE 2>&1 | tee -a $LOGDIR/install.log |
|
57 |
done
|
|
58 |
||
59 |
echo "::: Rebooting" 2>&1 | tee -a $LOGDIR/info.log |
|
60 |
adb reboot |
|
61 |
wait_for_device |
|
62 |
read -p "Wait for launcher to appear, then unlock the screen, then press enter here" |
|
63 |
||
64 |
echo "::: Kill powerd" |
|
65 |
pause 5
|
|
66 |
adb shell stop powerd |
|
67 |
||
68 |
echo "::: Stop Maliit" |
|
69 |
adb shell sudo -u phablet -i stop maliit-server |
|
70 |
||
71 |
pause 10
|
|
72 |
for APP in $(adb shell ls /home/phablet/.local/share/applications/*.desktop | tr -d '\r') |
|
73 |
do
|
|
74 |
LAUNCH=`basename $APP | sed 's/.desktop//'` |
|
75 |
echo "::: Starting app $APP" 2>&1 | tee -a $LOGDIR/info.log |
|
76 |
echo adb shell sudo -u phablet -i start application APP_ID=$LAUNCH |
|
77 |
adb shell sudo -u phablet -i start application APP_ID=$LAUNCH 2>&1 | tee -a $LOGDIR/$LAUNCH.log |
|
78 |
pause 10
|
|
79 |
echo "::: Take screenshot" 2>&1 | tee -a $LOGDIR/info.log |
|
80 |
screen_grab |
|
81 |
echo "::: Stopping app $APP" 2>&1 | tee -a $LOGDIR/info.log |
|
82 |
adb shell sudo -u phablet -i upstart-app-stop $LAUNCH
|
|
83 |
echo "::: Pull upstart log for $APP" 2>&1 | tee -a $LOGDIR/info.log |
|
84 |
adb pull /home/phablet/.cache/upstart/application-click-$LAUNCH.log $LOGDIR |
|
85 |
COLOR=`convert $LOGDIR/$LAUNCH.png -gravity center -crop 70x70%+0+0 -scale 1x1\! -depth 8 txt:- | tail -1 | awk '{print $3}'` |
|
86 |
echo $COLOR |
|
87 |
if [ "$COLOR" == "#FFFFFF" ] || [ "$COLOR" == "#000000" ]; then |
|
88 |
echo "::: Possible problem with $APP" 2>&1 | tee -a $LOGDIR/info.log |
|
89 |
mv $LOGDIR/application-click-$LAUNCH.log $LOGDIR/issues |
|
90 |
mv $LOGDIR/$LAUNCH.png $LOGDIR/issues |
|
91 |
fi
|
|
92 |
done
|
|
93 |
echo "::: Rebooting" 2>&1 | tee -a $LOGDIR/info.log |
|
94 |
adb reboot |
|
95 |
||
96 |
||
97 |