summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-11-24 11:33:37 +0000
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-11-24 11:33:37 +0000
commit5612717d7e96fbfd86f63abbca8bb735ff4e50b3 (patch)
treeb8c6aa87faf0efec7cbf6d4ece2e21222ba5730a
parent74e5ef0fa73cce4690de3005f01da890243bb510 (diff)
parent56b6aa8fdfedf66653ecc91c26bbda90c90f5c17 (diff)
Merge branch 'master' of ssh://git.linaro.org/qa/android-apk-automation
-rw-r--r--glbenchmark-2.5.1/com.glbenchmark.glbenchmark25_preferences.xml14
-rwxr-xr-xglbenchmark-2.5.1/execute.sh22
-rwxr-xr-xglbenchmark-2.5.1/file_transfer.sh60
-rwxr-xr-xglbenchmark-2.5.1/get_result.sh16
-rwxr-xr-xglbenchmark-2.5.1/glbenchmark_first_launch.py23
-rw-r--r--glbenchmark-2.5.1/main.1.com.glbenchmark.glbenchmark25.obbbin0 -> 15556718 bytes
-rwxr-xr-xglbenchmark-2.5.1/preparation.sh8
-rw-r--r--glbenchmark-2.5.1/session.xml3
-rwxr-xr-xglbenchmark-2.5.1/vc.py106
9 files changed, 252 insertions, 0 deletions
diff --git a/glbenchmark-2.5.1/com.glbenchmark.glbenchmark25_preferences.xml b/glbenchmark-2.5.1/com.glbenchmark.glbenchmark25_preferences.xml
new file mode 100644
index 0000000..1315e4c
--- /dev/null
+++ b/glbenchmark-2.5.1/com.glbenchmark.glbenchmark25_preferences.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<map>
+<string name="edition">COMMUNITY</string>
+<string name="username">androidcommunityuser</string>
+<string name="customoffscreenresolution">1920x1080</string>
+<boolean name="batterytest" value="false" />
+<boolean name="dontshowdialogregisterwarning" value="true" />
+<string name="customresolution">0x0</string>
+<boolean name="offscreenbutton" value="true" />
+<string name="devicename">pandaboard</string>
+<boolean name="disableupload" value="true" />
+<string name="password">asdojavmdthjwejgasogaouhgaufiuadxfoafgaosdcjaocaod</string>
+<boolean name="onscreenbutton" value="true" />
+</map>
diff --git a/glbenchmark-2.5.1/execute.sh b/glbenchmark-2.5.1/execute.sh
new file mode 100755
index 0000000..9c8c824
--- /dev/null
+++ b/glbenchmark-2.5.1/execute.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# need to be defined for different benchmark apks
+activity="com.glbenchmark.glbenchmark25/com.glbenchmark.activities.GLBenchmarkDownloaderActivity"
+apk_file_name="GLBenchmark_2.5.1.apk"
+excluded_test_suite="C24Z24MS4"
+# The first added parameter has been reserved by Android View Client.
+# In order to add customised parameter, the first one must be the serial number from ADB
+if [ -z "$1" ]; then
+ device_serial_number=`adb get-serialno`
+else
+ device_serial_number=$1
+fi
+test_method="python vc.py $device_serial_number $excluded_test_suite"
+apk_package="com.glbenchmark.glbenchmark25"
+
+# following should no need to modify
+parent_dir=`dirname ${0}`
+source "${parent_dir}/../common/common.sh"
+post_install="${parent_dir}/preparation.sh"
+timeout=45m
+main "$@"
diff --git a/glbenchmark-2.5.1/file_transfer.sh b/glbenchmark-2.5.1/file_transfer.sh
new file mode 100755
index 0000000..531bb56
--- /dev/null
+++ b/glbenchmark-2.5.1/file_transfer.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+# Author: Botao Sun <botao.sun@linaro.org>
+# Transfer obb and pre-config file from host to target device
+
+obb_basic_path="/storage/sdcard0/Android"
+config_basic_path="/data/data/com.glbenchmark.glbenchmark25"
+errorword="No such"
+
+function push_obb(){
+ if [ ! -f $1 ]; then
+ echo "Unable to find obb file!"
+ return 1
+ fi
+
+ adb shell ls $obb_basic_path | grep "$errorword"
+
+ if [ $? -eq 0 ]; then
+ echo "$obb_basic_path does not exist on device!"
+ return 1
+ fi
+
+ echo "File structure check OK! File transfer started..."
+ adb push $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "obb file push failed!"
+ return 1
+ else
+ echo "obb file pushed to device successfully!"
+ return 0
+ fi
+}
+
+function push_config(){
+ if [ ! -f $1 ]; then
+ echo "Unable to find config file!"
+ return 1
+ fi
+
+ adb shell ls $config_basic_path | grep "$errorword"
+
+ if [ $? -eq 0 ]; then
+ echo "$config_basic_path does not exist on device!"
+ return 1
+ fi
+
+ echo "File structure check OK! File transfer started..."
+ adb push $1 $2
+
+ if [ $? -ne 0 ]; then
+ echo "Config file push failed!"
+ return 1
+ else
+ echo "Config file pushed to device successfully!"
+ return 0
+ fi
+}
+
+push_obb "main.1.com.glbenchmark.glbenchmark25.obb" "$obb_basic_path/obb/com.glbenchmark.glbenchmark25/main.1.com.glbenchmark.glbenchmark25.obb"
+push_config "com.glbenchmark.glbenchmark25_preferences.xml" "$config_basic_path/shared_prefs/com.glbenchmark.glbenchmark25_preferences.xml"
diff --git a/glbenchmark-2.5.1/get_result.sh b/glbenchmark-2.5.1/get_result.sh
new file mode 100755
index 0000000..7b5684c
--- /dev/null
+++ b/glbenchmark-2.5.1/get_result.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Author: Botao Sun <botao.sun@linaro.org>
+
+function get_cached_result(){
+ echo "Cached result transfer in progress..."
+ adb pull $1 $2
+ if [ $? -ne 0 ]; then
+ echo "Cached result transfer failed!"
+ return 1
+ else
+ echo "Cached result transfer finished!"
+ return 0
+ fi
+}
+
+get_cached_result "/data/data/com.glbenchmark.glbenchmark25/cache/last_results_2.5.1.xml" "last_results_2.5.1.xml"
diff --git a/glbenchmark-2.5.1/glbenchmark_first_launch.py b/glbenchmark-2.5.1/glbenchmark_first_launch.py
new file mode 100755
index 0000000..1a153d2
--- /dev/null
+++ b/glbenchmark-2.5.1/glbenchmark_first_launch.py
@@ -0,0 +1,23 @@
+# Author: Botao Sun <botao.sun@linaro.org>
+# First touch on GLBenchmark
+
+import time
+import re
+from com.dtmilano.android.viewclient import ViewClient
+
+device, serialno = ViewClient.connectToDeviceOrExit()
+vc = ViewClient(device, serialno)
+time.sleep(2)
+
+apps_tab = vc.findViewWithContentDescriptionOrRaise(re.compile('Apps'))
+apps_tab.touch()
+time.sleep(5)
+
+vc.dump(window='-1')
+target_app = vc.findViewWithText("GLBenchmark 2.5.1")
+target_app.touch()
+print "GLBenchmark 2.5.1 touched!"
+time.sleep(15)
+
+device.press('KEYCODE_BACK')
+time.sleep(3)
diff --git a/glbenchmark-2.5.1/main.1.com.glbenchmark.glbenchmark25.obb b/glbenchmark-2.5.1/main.1.com.glbenchmark.glbenchmark25.obb
new file mode 100644
index 0000000..6f6acbb
--- /dev/null
+++ b/glbenchmark-2.5.1/main.1.com.glbenchmark.glbenchmark25.obb
Binary files differ
diff --git a/glbenchmark-2.5.1/preparation.sh b/glbenchmark-2.5.1/preparation.sh
new file mode 100755
index 0000000..2b6a616
--- /dev/null
+++ b/glbenchmark-2.5.1/preparation.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# Author: Botao Sun <botao.sun@linaro.org>
+
+./file_transfer.sh
+sleep 2
+
+python glbenchmark_first_launch.py
+sleep 2
diff --git a/glbenchmark-2.5.1/session.xml b/glbenchmark-2.5.1/session.xml
new file mode 100644
index 0000000..9fd82bd
--- /dev/null
+++ b/glbenchmark-2.5.1/session.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="US-ASCII" ?>
+<session version="1" title="GLBenchmark-2.5.1" target_path="@F" call_stack_unwinding="yes" parse_debug_info="yes" high_resolution="no" buffer_mode="streaming" sample_rate="normal" duration="0">
+</session>
diff --git a/glbenchmark-2.5.1/vc.py b/glbenchmark-2.5.1/vc.py
new file mode 100755
index 0000000..4165fa5
--- /dev/null
+++ b/glbenchmark-2.5.1/vc.py
@@ -0,0 +1,106 @@
+# Author: Botao Sun <botao.sun@linaro.org>
+
+import sys
+import time
+import re
+import xml.dom.minidom
+from subprocess import call
+from com.dtmilano.android.viewclient import ViewClient
+
+def collect_score(benchmark_name, run_result, score_number, score_unit):
+ call(['lava-test-case', benchmark_name, '--result', run_result, '--measurement', str(score_number), '--units', score_unit])
+
+def getText(node):
+ children = node.childNodes
+ rc = []
+ for node in children:
+ if node.nodeType == node.TEXT_NODE:
+ rc.append(node.data)
+ return ''.join(rc)
+
+def logparser(cached_result_file):
+ run_result = 'pass'
+ dom = xml.dom.minidom.parse(cached_result_file)
+ results = dom.getElementsByTagName('test_result')
+
+ for test in results:
+ title = getText(test.getElementsByTagName('title')[0])
+ test_type = getText(test.getElementsByTagName('type')[0])
+ score_number = getText(test.getElementsByTagName('score')[0])
+ fps = getText(test.getElementsByTagName('fps')[0])
+ score_unit = getText(test.getElementsByTagName('uom')[0])
+ benchmark_name = title.replace(" ", "-").replace(":", "") + "-" + test_type.replace(" ", "-").replace(":", "")
+
+ print benchmark_name, run_result, score_number, score_unit
+ collect_score(benchmark_name, run_result, score_number, score_unit)
+ if fps != "":
+ score_number = fps.split(" ")[0]
+ score_unit = fps.split(" ")[1]
+ print benchmark_name, run_result, score_number, score_unit
+ collect_score(benchmark_name, run_result, score_number, score_unit)
+
+cached_result_file = "last_results_2.5.1.xml"
+device, serialno = ViewClient.connectToDeviceOrExit()
+vc = ViewClient(device, serialno)
+time.sleep(2)
+
+vc.dump(window='-1')
+test_type = vc.findViewWithText("Performance Tests")
+test_type.touch()
+time.sleep(2)
+
+# By some reason in order to select all test, a back step is required
+vc.dump(window='-1')
+test_selection = vc.findViewByIdOrRaise("com.glbenchmark.glbenchmark25:id/buttonAll")
+device.press('KEYCODE_BACK')
+time.sleep(3)
+
+test_type.touch()
+time.sleep(2)
+test_selection.touch()
+print "All selected!"
+time.sleep(3)
+
+# Disable crashed test suites
+vc.dump(window='-1')
+if len(sys.argv) > 3:
+ print "Parameter Invalid!\nUsage: python vc.py <serialno> <disabled_test_suite>.\nTo run all test simply use python vc.py without any parameter or just with <serialno>.\nIt currently only supports to disable 1 test suite, more flexbility may will be added in future."
+ sys.exit(1)
+elif len(sys.argv) == 3:
+ print "Test suite " + sys.argv[2] + " is going to be disabled!"
+ crashed_test_name = sys.argv[2]
+ crashed_test = vc.findViewWithText(crashed_test_name)
+ if crashed_test != None:
+ crashed_test.touch()
+ print "Test suite " + crashed_test_name + " has been excluded!"
+ time.sleep(2)
+ else:
+ print "Can not find test suite " + crashed_test_name + ", please check the screen!"
+elif len(sys.argv) == 2 or len(sys.argv) == 1:
+ pass
+
+# Start selected test suites
+start_button = vc.findViewByIdOrRaise("com.glbenchmark.glbenchmark25:id/buttonStart")
+start_button.touch()
+time.sleep(2)
+
+finished = False
+while (not finished):
+ time.sleep(120)
+ vc.dump(window='-1')
+ flag = vc.findViewWithText("Result processing")
+ if flag != None:
+ print "GLBenchmark Test Finished!"
+ finished = True
+ # Give up the result upload
+ cancel_button = vc.findViewWithText("Cancel")
+ if cancel_button != None:
+ cancel_button.touch()
+ time.sleep(5)
+ else:
+ print "Can not find cancel button! Please check the pop up window!"
+ else:
+ print "GLBenchmark Test is still in progress..."
+
+call_return = call(['./get_result.sh'])
+logparser(cached_result_file) \ No newline at end of file