forked from pelya/commandergenius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regression.sh
executable file
·94 lines (85 loc) · 3.43 KB
/
regression.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
if [ -z "$1" ] ; then
echo "Usage: $0 startdate [enddate=now] [revisions-step=10]"
echo "Runs regression tests for all Git revisions up to specified date,"
echo "and produces the FPS measurements for each of the revisions."
echo "Naturally, you'll need to have an Android device connected to USB port,"
echo "and you should disable screen timeout in the Android device settings."
echo "Also, it messes up your current Git branch, so backup all your current changes,"
echo "and you'll have to run command 'git checkout -f sdl_android' after you're done."
fi
if echo "$0" | grep "regression/run-regression.sh" ; then
echo Running FPS regression tests
else
mkdir -p regression
cp -f "$0" regression/run-regression.sh
chmod a+x regression/run-regression.sh
regression/run-regression.sh "$@"
exit $?
fi
FROM="$1"
FROM="`git log -n 1 --format='%cD' \"@{$FROM}\" --`"
TO="$2"
if [ -z "$TODATE" ] ; then
TO="`git log -n 1 --format='%cD' --`"
fi
STEP="$3"
if [ -z "$STEP" ] ; then
STEP=10
fi
REVLIMIT="2011-05-31 16:30:08"
if [ `date -d "$REVLIMIT" "+%s"` -gt `date -d "$FROM" "+%s"` ] ; then
echo "----- WARNING ----- ----- WARNING ----- ----- WARNING ----- ----- WARNING -----"
echo "The revisions below date $REVLIMIT do not support skipping the config dialog,"
echo "so they will stuck at the config screen after launching, so no data will be collected."
echo "You will have to launch the tests with those .apk files manually"
echo "----- WARNING ----- ----- WARNING ----- ----- WARNING ----- ----- WARNING -----"
fi
#export OLDBRANCH=`git branch | grep '*' | sed 's/[* ]*//'`
#export CURDIR="`pwd`"
#function restoreGit() {
# echo Restoring Git branch "$OLDBRANCH"
# rm -rf "$CURDIR/project/jni/application/regression"
# git checkout -f "$OLDBRANCH"
# exit 0
#}
#trap restoreGit SIGHUP
echo Revisions from "$FROM" to "$TO" , step "$STEP"
rm -rf regression/regression
cp -r project/jni/application/regression regression/regression
git checkout -f "@{$TO}"
CURRENT="`git log -n 1 --format='%cD' --`"
while [ `date -d "$CURRENT" "+%s"` -gt `date -d "$FROM" "+%s"` ] ; do
CURFMT="`git log -n 1 --format='%ci' -- | sed 's/[+].*//' | sed 's/ /::/'`"
CURFMT=`echo $CURFMT | sed 's/ //'`
echo \"$CURFMT\"
rm -f project/jni/application/src
rm -rf project/jni/application/regression
cp -rf regression/regression project/jni/application/regression
ln -s regression project/jni/application/src
./ChangeAppSettings.sh -a
echo Patching project/src/Globals.java
cat project/src/Globals.java | \
sed "s/public static boolean DownloadToSdcard = .*;/public static boolean DownloadToSdcard = false;/" > \
project/src/Globals.java.1
mv -f project/src/Globals.java.1 project/src/Globals.java
echo "#define BUILDDATE \"$CURFMT\"" > project/jni/application/regression/regression.h
rm -rf project/obj
cd project
nice -n19 ndk-build V=1 -j4 && ant debug && cp -f bin/DemoActivity-debug.apk ../regression/$CURFMT.apk
cd ..
adb shell pm uninstall net.olofson.ballfield.regression
sleep 2
adb install -r regression/$CURFMT.apk
sleep 5
adb shell am start -n net.olofson.ballfield.regression/.MainActivity
sleep 40
echo >> regression/regression.txt
echo BUILDDATE $CURFMT: "`git log -n 1 --format="%s"`" >> regression/regression.txt
echo >> regression/regression.txt
adb shell logcat -d -t 20 | grep "SDL REGRESSION BUILDDATE $CURFMT" >> regression/regression.txt
adb shell pm uninstall net.olofson.ballfield.regression
git checkout -f "HEAD~$STEP"
CURRENT="`git log -n 1 --format='%cD' --`"
done
#restoreGit