summaryrefslogtreecommitdiff
path: root/automated/android/apk-automation/javawhetstone.py
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-30 18:54:46 +0100
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-04-28 09:50:02 +0000
commitab48dcadc4eb74a126a8d76bece720ab000b1452 (patch)
tree4cf508236cf2cf8d44ff2552bf7b2d7a6fdee58b /automated/android/apk-automation/javawhetstone.py
parentd92cc5a7e7461e7fe493a3a1be0bbdc7a94f9892 (diff)
automated: android: add refactored apk-automation
Change-Id: I5a81b3c4317dc56f90df37c5a8f83d2547542fab Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'automated/android/apk-automation/javawhetstone.py')
-rwxr-xr-xautomated/android/apk-automation/javawhetstone.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/automated/android/apk-automation/javawhetstone.py b/automated/android/apk-automation/javawhetstone.py
new file mode 100755
index 0000000..a5d974d
--- /dev/null
+++ b/automated/android/apk-automation/javawhetstone.py
@@ -0,0 +1,63 @@
+import re
+import time
+from common import ApkTestRunner
+from com.dtmilano.android.viewclient import ViewNotFoundException
+
+
+class ApkRunnerImpl(ApkTestRunner):
+ def __init__(self, config):
+ self.config = config
+ self.config['apk_file_name'] = 'JavaBenchmark/pure-java-benchmarks/01-Java_Whetstone.apk'
+ self.config['apk_package'] = 'com.roywhet'
+ self.config['activity'] = 'com.roywhet/.JavaWhetstoneActivity'
+ super(ApkRunnerImpl, self).__init__(self.config)
+
+ def execute(self):
+ self.dump_always()
+ btn_run = self.vc.findViewByIdOrRaise("com.roywhet:id/startButton")
+ btn_run.touch()
+ time.sleep(2)
+
+ finished = False
+ while not finished:
+ try:
+ time.sleep(30)
+ self.dump_always()
+ self.jws_results = self.vc.findViewByIdOrRaise("com.roywhet:id/displayDetails")
+ if re.search('Total Elapsed Time', self.jws_results.getText()):
+ finished = True
+ self.logger.info('benchmark finished')
+ except ViewNotFoundException:
+ pass
+ except RuntimeError:
+ pass
+ except ValueError:
+ pass
+
+ def parseResult(self):
+ key_unit_hash = {
+ "N1": "MFLOPS",
+ "N2": "MFLOPS",
+ "N3": "MOPS",
+ "N4": "MOPS",
+ "N5": "MOPS",
+ "N6": "MFLOPS",
+ "N7": "MOPS",
+ "N8": "MOPS",
+ "MWIPS": "MFLOPS"
+ }
+
+ for line in self.jws_results.getText().split('\n'):
+ line = str(line.strip())
+ elements = re.split(r'\s+', line)
+ if line.startswith('MWIPS'):
+ units = key_unit_hash['MWIPS']
+ key = "MWIPS"
+ value = elements[1]
+ elif line.startswith('N'):
+ units = key_unit_hash[elements[0]]
+ key = "%s-%s" % (elements[0], elements[1])
+ value = elements[2]
+ else:
+ continue
+ self.report_result('javawhetstone-%s' % key, 'pass', value, units)