summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-03-04 00:08:58 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-03-04 00:35:13 +0800
commit6693de5fd8494a794e7bfa26ee803e586516692a (patch)
treeb74cbeb90cb8b78927eb9a978eb4f03e74bc052e
parent42034473c5808b6a71501e9fd1869f24d20e0122 (diff)
Add test for AndEBench Promerge
Change-Id: I7a673edb4b70f76090bdf57ffca01cac39599f61 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xandebenchpro/execute.sh58
-rw-r--r--andebenchpro/vc.py61
2 files changed, 119 insertions, 0 deletions
diff --git a/andebenchpro/execute.sh b/andebenchpro/execute.sh
new file mode 100755
index 0000000..789b581
--- /dev/null
+++ b/andebenchpro/execute.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#need to be defined for different benchmark apks
+apk_package="com.eembc.andebench"
+activity="com.eembc.andebench/.splash"
+apk_file_name="andebench-pro.apk"
+test_method="python vc.py"
+
+#following should no need to modify
+parent_dir=`dirname ${0}`
+source "${parent_dir}/../common/common.sh"
+
+function get_result(){
+ local host_csv_f="/tmp/andebench.log.csv"
+ adb pull /mnt/sdcard/Download/andebench.log.csv "${host_csv_f}"
+ sed -i 's/ /_/g' "${host_csv_f}"
+ sed -i 's/(\|)//g' "${host_csv_f}"
+ local regex="^CoreMark-HPC|^Memory Bandwidth,|^Memory Latency,|^Storage,|^Platform,|^3D,|^Overall"
+ for line in $(grep -P "${regex}" /tmp/andebench.log.csv); do
+ local field1=$(echo $line|cut -d, -f1)
+ local field2=$(echo $line|cut -d, -f2)
+ local field3=$(echo $line|cut -d, -f3)
+
+ local key=""
+ local value=""
+ local result=""
+ local units=""
+ if [ -z "${field3}" ]; then
+ key="${field1}"
+ value="${field2}"
+ else
+ key="${field1}_${field2}"
+ value="${field3}"
+ fi
+ old_value="${value}"
+ if echo "${old_value}"|grep -q -P '\d$'; then
+ value="${old_value}"
+ units="points"
+ result="pass"
+ elif [ "X${old_value}" = "XNA" ];then
+ result="fail"
+ else
+ value=$(echo ${old_value}|tr -d "[:alpha:]/")
+ units=$(echo ${old_value}|tr -d "[:digit:].")
+ result="pass"
+ fi
+ echo "${key}=${value}${units}"
+ local cmd_lava_test_case="lava-test-case"
+ if [ "X${result}" = "Xpass" ]; then
+ ${cmd_lava_test_case} "${key}" "--result" "pass" "--measurement" "${value}" "--units" "${units}"
+ else
+ ${cmd_lava_test_case} "${key}" "--result" "fail"
+ fi
+ done
+ rm -fr "${host_csv_f}"
+}
+pre_uninstall="get_result"
+main "$@"
diff --git a/andebenchpro/vc.py b/andebenchpro/vc.py
new file mode 100644
index 0000000..25bb404
--- /dev/null
+++ b/andebenchpro/vc.py
@@ -0,0 +1,61 @@
+import re
+import sys
+import os
+import time
+from subprocess import call
+
+from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException
+
+kwargs1 = {'verbose': False, 'ignoresecuredevice': False}
+device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
+kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True, 'compresseddump': False}
+vc = ViewClient(device, serialno, **kwargs2)
+
+time.sleep(2)
+vc.dump()
+btn_license = vc.findViewWithText(u'I Agree')
+if btn_license:
+ btn_license.touch()
+
+while True:
+ try:
+ time.sleep(5)
+ vc.dump()
+ btn_start_on = vc.findViewByIdOrRaise("com.eembc.andebench:id/s1_runall")
+ btn_start_on.touch()
+ break
+ except ViewNotFoundException:
+ pass
+ except RuntimeError:
+ pass
+ except ValueError:
+ pass
+
+while(True):
+ try:
+ time.sleep(30)
+ vc.dump('-1')
+ vc.findViewByIdOrRaise("com.eembc.andebench:id/view_web_button")
+
+ vc.findViewWithTextOrRaise(u'3D').touch()
+ vc.findViewWithTextOrRaise(u'Platform').touch()
+ vc.findViewWithTextOrRaise(u'Storage').touch()
+ vc.findViewWithTextOrRaise(u'Memory Latency').touch()
+ vc.findViewWithTextOrRaise(u'Memory Bandwidth').touch()
+ vc.findViewWithTextOrRaise(u'CoreMark-HPC (Peak)').touch()
+ vc.findViewWithTextOrRaise(u'CoreMark-HPC (Base)').touch()
+ '''
+ if not results.getText().find("Running") > 0:
+ print "benchmark finished"
+ result_re = re.compile("(?P<test_case_id>[a-zA-Z\s]+):\s(?P<measurement>\d+)", re.MULTILINE)
+ search_results = result_re.finditer(results.getText())
+ for result in search_results:
+ call(['lava-test-case', result.group('test_case_id'), '--result', 'pass', '--measurement', result.group('measurement'), '--units', 'Iterations/sec'])
+ '''
+ break
+ except ViewNotFoundException:
+ pass
+ except RuntimeError:
+ pass
+ except ValueError:
+ pass