diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-03-30 18:54:46 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-04-28 09:50:02 +0000 |
commit | ab48dcadc4eb74a126a8d76bece720ab000b1452 (patch) | |
tree | 4cf508236cf2cf8d44ff2552bf7b2d7a6fdee58b /automated/android/apk-automation/jbench.py | |
parent | d92cc5a7e7461e7fe493a3a1be0bbdc7a94f9892 (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/jbench.py')
-rwxr-xr-x | automated/android/apk-automation/jbench.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/automated/android/apk-automation/jbench.py b/automated/android/apk-automation/jbench.py new file mode 100755 index 0000000..0481081 --- /dev/null +++ b/automated/android/apk-automation/jbench.py @@ -0,0 +1,40 @@ +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/03-JBench.apk' + self.config['apk_package'] = 'it.JBench.bench' + self.config['activity'] = 'it.JBench.bench/it.JBench.jbench.MainActivity' + super(ApkRunnerImpl, self).__init__(self.config) + + def execute(self): + self.dump_always() + btn_jbench = self.vc.findViewByIdOrRaise("it.JBench.bench:id/button1") + btn_jbench.touch() + time.sleep(2) + + finished = False + while (not finished): + try: + time.sleep(5) + self.dump_always() + results = self.vc.findViewByIdOrRaise("it.JBench.bench:id/textViewResult") + if re.search('^\d+$', results.getText()): + finished = True + print("benchmark finished") + print("%s=%s" % ("JBench", results.getText().strip())) + self.report_result("jbench", 'pass', results.getText().strip(), 'points') + except ViewNotFoundException: + pass + except RuntimeError: + pass + except ValueError: + pass + + def parseResult(self): + pass |