summaryrefslogtreecommitdiff
path: root/automated/android/apk-automation/jbench.py
diff options
context:
space:
mode:
Diffstat (limited to 'automated/android/apk-automation/jbench.py')
-rwxr-xr-xautomated/android/apk-automation/jbench.py40
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