summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2018-08-16 09:05:43 +0000
committerLinaro Code Review <review@review.linaro.org>2018-08-16 09:05:43 +0000
commit1bab3b59a8f6ee96dd5dc1ef0c19d42f16af6b91 (patch)
tree4eb4f05ca5d44442d284d5364f8bb8c53ae463f8
parentbeed9fb4da0248b826c16040c50963e25c4251e8 (diff)
parent16b780512dc2a3c47cfb4b3f2b86a1a687782f06 (diff)
Merge "android apk-automation: add Geekbench4 test"
-rwxr-xr-xautomated/android/apk-automation/geekbench4.py100
1 files changed, 100 insertions, 0 deletions
diff --git a/automated/android/apk-automation/geekbench4.py b/automated/android/apk-automation/geekbench4.py
new file mode 100755
index 0000000..5e53219
--- /dev/null
+++ b/automated/android/apk-automation/geekbench4.py
@@ -0,0 +1,100 @@
+import glob
+import json
+import os
+import sys
+import shutil
+import time
+from common import ApkTestRunner
+from com.dtmilano.android.viewclient import ViewNotFoundException
+
+## geekbench-3-4-2-0.apk
+## Version is 4.2.0
+## size: 100171060
+## md5sum: 6df73d9b5c3f9fe7383683856985a153
+## Url:
+## https://geekbench-3.en.uptodown.com/android
+## https://play.google.com/store/apps/details?id=com.primatelabs.geekbench
+
+
+class ApkRunnerImpl(ApkTestRunner):
+ def __init__(self, config):
+ self.config = config
+ self.config['apk_file_name'] = "geekbench-3-4-2-0.apk"
+ self.config['apk_package'] = "com.primatelabs.geekbench"
+ self.config['activity'] = "com.primatelabs.geekbench/.HomeActivity"
+ super(ApkRunnerImpl, self).__init__(self.config)
+
+ def all_fail(self):
+ self.report_result('geekbench-run', 'fail')
+ self.report_result('geekbench-single-core', 'skip')
+ self.report_result('geekbench-multi-core', 'skip')
+
+ def execute(self):
+ find_run_btn = False
+ while not find_run_btn:
+ time.sleep(5)
+ self.dump_always()
+ agreement = self.vc.findViewWithText(u'By using Geekbench you are agreeing to the terms of the Geekbench End User License Agreement and Privacy Policy.')
+ if agreement:
+ accept_btn = self.vc.findViewWithTextOrRaise(u'ACCEPT')
+ accept_btn.touch()
+ continue
+
+ no_internet = self.vc.findViewWithText(u'Geekbench encountered an error communicating with the Geekbench Browser. Geekbench requires an active internet connection in order to run benchmarks.')
+ if no_internet:
+ self.logger.info("Geekbench requires an active internet connection in order to run benchmarks!")
+ self.all_fail()
+ sys.exit(1)
+
+ runBench = self.vc.findViewWithText(u'RUN CPU BENCHMARK')
+ if runBench:
+ runBench.touch()
+ find_run_btn = True
+ self.logger.info("Geekbench 4 Test Started!")
+
+ finished = False
+ while (not finished):
+ time.sleep(10)
+ self.dump_always()
+ progress = self.vc.findViewById("android:id/progress")
+ progress_percent = self.vc.findViewById("android:id/progress_percent")
+ if progress or progress_percent:
+ self.logger.info("Geekbench 4 Test is still in progress...")
+ continue
+
+ geekbench_score = self.vc.findViewWithText(u'Geekbench Score')
+ if geekbench_score:
+ self.logger.info("Geekbench 4 Test Finished!")
+ finished = True
+ continue
+
+ self.logger.error("Something goes wrong! It is unusual that the test has not been started after 10+ seconds! Please manually check it!")
+ #self.all_fail()
+ #sys.exit(1)
+
+ def parseResult(self):
+ raw_output_file = '%s/geekbench3-result-itr%s.json' % (self.config['output'], self.config['itr'])
+ self.logger.info('Pulling /data/user/0/com.primatelabs.geekbench/files to output directory...')
+ self.call_adb('pull /data/user/0/com.primatelabs.geekbench/files %s/files' % self.config['output'])
+ db_file_list = glob.glob('%s/files/*.gb4' % self.config['output'])
+ if len(db_file_list) > 1:
+ self.logger.error('More then one db file found...')
+ sys.exit(1)
+ db_file = db_file_list[0]
+ os.rename(db_file, raw_output_file)
+
+ if os.path.exists(raw_output_file):
+ with open(raw_output_file, "r") as read_file:
+ res_data = json.load(read_file)
+ for sec in res_data['sections']:
+ self.report_result("Geekbench4-%s" % sec["name"], "pass", sec["score"], 'points')
+ sub_testcases = sec['workloads']
+ for sub_testcase in sub_testcases:
+ self.report_result("Geekbench4-%s-%s" % (sec["name"], sub_testcase["name"].replace(' ', '_')), "pass", sub_testcase["score"], 'points')
+ else:
+ self.logger.error("Result file does not exist: %s" % raw_output_file)
+ sys.exit(1)
+
+ def tearDown(self):
+ super(ApkRunnerImpl, self).tearDown()
+ shutil.rmtree('%s/files/' % self.config['output'])