summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2016-08-27 09:34:40 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2016-08-27 09:34:40 +0800
commit731b9cada11aec779f42ac6ebacbefd15bf9384a (patch)
tree35561360ee68cc0826c7232089dd28ce967a010e
parent81c516e6ff8e975e361903e15da0aff7c4d8f0a8 (diff)
add smartebench2012
Change-Id: I8cc2eda583c530b5b4e6777ba894e240ab73804b Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xsmartbench2012/execute.sh13
-rwxr-xr-xsmartbench2012/extract_results.sh10
-rw-r--r--smartbench2012/session.xml3
-rwxr-xr-xsmartbench2012/vc.py50
4 files changed, 76 insertions, 0 deletions
diff --git a/smartbench2012/execute.sh b/smartbench2012/execute.sh
new file mode 100755
index 0000000..fa5c96a
--- /dev/null
+++ b/smartbench2012/execute.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+#need to be defined for different benchmark apks
+activity="com.smartbench.twelve/.Smartbench2012"
+apk_file_name="Smartbench2012.apk"
+test_method="python vc.py"
+apk_package="com.smartbench.twelve"
+
+#following should no need to modify
+parent_dir=$(cd $(dirname ${0});pwd)
+source "${parent_dir}/../common/common.sh"
+post_uninstall="${parent_dir}/extract_results.sh"
+main "$@"
diff --git a/smartbench2012/extract_results.sh b/smartbench2012/extract_results.sh
new file mode 100755
index 0000000..c015ed4
--- /dev/null
+++ b/smartbench2012/extract_results.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+local_this_parent="$(cd $(dirname $0);pwd)"
+source "${local_this_parent}/../common/common.sh"
+
+SCORE=`awk -F'[][]' '/SBGlobal.nProductivityIndex/{k=$2}END{print k}' ${F_LOGCAT}`
+UNIT="points"
+
+echo "Score is: $SCORE"
+output_test_result SmartbenchScore pass $SCORE $UNIT
diff --git a/smartbench2012/session.xml b/smartbench2012/session.xml
new file mode 100644
index 0000000..ecca46b
--- /dev/null
+++ b/smartbench2012/session.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="US-ASCII" ?>
+<session version="1" title="Smartbench2012" 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/smartbench2012/vc.py b/smartbench2012/vc.py
new file mode 100755
index 0000000..0211596
--- /dev/null
+++ b/smartbench2012/vc.py
@@ -0,0 +1,50 @@
+import re
+import sys
+import os
+import time
+from subprocess import call
+
+from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException
+
+default_unit = 'points'
+def get_score_with_text(vc, text, offset=1):
+ score_view = vc.findViewWithTextOrRaise(text)
+ score_uid = score_view.getUniqueId()
+ uid = int(re.search("id/no_id/(?P<uid>\d+)", score_uid).group('uid'))
+ score = vc.findViewByIdOrRaise("id/no_id/%s" % (uid + offset))
+ call(['lava-test-case', text.strip(), '--result', 'pass', '--measurement', score.getText().strip(), '--units', default_unit])
+
+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)
+while True:
+ try:
+ time.sleep(5)
+ vc.dump('-1')
+ btn_start = vc.findViewWithTextOrRaise("Run SmartBench")
+ btn_start.touch()
+ break
+ except ViewNotFoundException:
+ pass
+ except RuntimeError:
+ pass
+ except ValueError:
+ pass
+
+finished = False
+while not finished:
+ try:
+ time.sleep(5)
+ vc.dump('-1')
+ btn_results = vc.findViewWithTextOrRaise("Display Index Scores")
+ btn_results.touch()
+ time.sleep(3)
+ print "benchmark finished"
+ finished = True
+ except ViewNotFoundException:
+ pass
+ except RuntimeError:
+ pass
+ except ValueError:
+ pass