/
multirun.sh
executable file
·65 lines (50 loc) · 1.28 KB
/
multirun.sh
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/bash
N="$1"
PACKAGE="$2"
ACTIVITY="$3"
APK_ORIGINAL="$4"
APK_INSTRUMENTED="$APK_ORIGINAL.dexter"
for i in $(seq 1 $N)
do
echo "TRIAL #$i"
echo " - uninstalling the package"
adb uninstall $PACKAGE > /dev/null
echo " - installing the original APK"
ADB_OUTPUT=`adb install "$APK_ORIGINAL" 2>/dev/null | tail -n 1`
if [[ "$ADB_OUTPUT" != Success* ]]
then
echo "$ADB_OUTPUT"
echo "ERROR: couldn't install APK"
exit;
fi
echo " - clearing the system log"
adb logcat -c
echo " - launching the application"
adb shell am start -n "$PACKAGE"/."$ACTIVITY"
# echo " - please press ENTER"
# read X
echo " - waiting 2 seconds..."
sleep 2
echo " - saving logcat"
adb logcat -d > "multirun-$i-o.logcat"
echo " - uninstalling the package"
adb uninstall $PACKAGE > /dev/null
echo " - installing the instrumented APK"
ADB_OUTPUT=`adb install "$APK_INSTRUMENTED" 2>/dev/null | tail -n 1`
if [[ "$ADB_OUTPUT" != Success* ]]
then
echo "$ADB_OUTPUT"
echo "ERROR: couldn't install APK"
exit;
fi
echo " - clearing the system log"
adb logcat -c
echo " - launching the application"
adb shell am start -n "$PACKAGE"/."$ACTIVITY"
# echo " - please press ENTER"
# read X
echo " - waiting 2 seconds..."
sleep 2
echo " - saving logcat"
adb logcat -d > "multirun-$i-i.logcat"
done