summaryrefslogtreecommitdiff
path: root/automated/android/apk-automation/rl-sqlite.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/rl-sqlite.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/rl-sqlite.py')
-rwxr-xr-xautomated/android/apk-automation/rl-sqlite.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/automated/android/apk-automation/rl-sqlite.py b/automated/android/apk-automation/rl-sqlite.py
new file mode 100755
index 0000000..48ff4a8
--- /dev/null
+++ b/automated/android/apk-automation/rl-sqlite.py
@@ -0,0 +1,61 @@
+import time
+from common import ApkTestRunner
+
+
+class ApkRunnerImpl(ApkTestRunner):
+ def __init__(self, config):
+ self.config = config
+ self.config['apk_file_name'] = 'RL_Benchmark_SQLite_v1.3.apk'
+ self.config['apk_package'] = 'com.redlicense.benchmark.sqlite'
+ self.config['activity'] = 'com.redlicense.benchmark.sqlite/.Main'
+ super(ApkRunnerImpl, self).__init__(self.config)
+
+ def execute(self):
+ self.dump_always()
+ btn_start = self.vc.findViewWithTextOrRaise(u'Start')
+ btn_start.touch()
+
+ finished = False
+ while(not finished):
+ self.dump_always()
+ overall_result = self.vc.findViewWithText(u'Overall')
+ if overall_result:
+ finished = True
+ self.logger.info("benchmark finished")
+
+ def __get_score_with_text(self, text):
+ found_score_view = False
+ while not found_score_view:
+ linear_layout = self.vc.findViewByIdOrRaise("com.redlicense.benchmark.sqlite:id/stats")
+ for ch in linear_layout.children:
+ subitem = self.vc.findViewWithText(text, ch)
+ if subitem:
+ subitem_result = self.vc.findViewByIdOrRaise("com.redlicense.benchmark.sqlite:id/test_result", ch)
+ score = subitem_result.getText().replace("sec", "").strip()
+ score_in_ms = float(score) * 1000
+ self.report_result("RL-sqlite-" + text.replace(" ", "-"), 'pass', str(score_in_ms), "ms")
+ found_score_view = True
+ break
+ if subitem is None:
+ self.logger.info("%s not found, need to pageup" % text)
+ self.device.press('DPAD_UP')
+ time.sleep(2)
+ self.device.press('DPAD_UP')
+ time.sleep(2)
+ self.dump_always()
+
+ def parseResult(self):
+ self.__get_score_with_text("Overall")
+ self.__get_score_with_text("DROP TABLE")
+ self.__get_score_with_text("DELETE with an index")
+ self.__get_score_with_text("DELETE without an index")
+ self.__get_score_with_text("INSERTs from a SELECT")
+ self.__get_score_with_text("25000 UPDATEs with an index")
+ self.__get_score_with_text("1000 UPDATEs without an index")
+ self.__get_score_with_text("5000 SELECTs with an index")
+ self.__get_score_with_text("Creating an index")
+ self.__get_score_with_text("100 SELECTs on a string comparison")
+ self.__get_score_with_text("100 SELECTs without an index")
+ self.__get_score_with_text("25000 INSERTs into an indexed table in a transaction")
+ self.__get_score_with_text("25000 INSERTs in a transaction")
+ self.__get_score_with_text("1000 INSERTs")