diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2015-09-25 15:03:19 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2015-09-25 15:05:50 +0800 |
commit | 6b87ec47b5d1951a29175ddc1cb1f6692ca0ae59 (patch) | |
tree | 91f301061cc5a6175c5f2a016503121b197d5fa6 | |
parent | 93f8eac530788d0f3919358ae926afe47e884cc7 (diff) |
enable caffeinemark test implementation
Change-Id: If13b19e956dbf8cee627094e0de19b3cffb0d0b8
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-x | caffeinemark/execute.sh | 12 | ||||
-rw-r--r-- | caffeinemark/session.xml | 3 | ||||
-rwxr-xr-x | caffeinemark/vc.py | 90 |
3 files changed, 105 insertions, 0 deletions
diff --git a/caffeinemark/execute.sh b/caffeinemark/execute.sh new file mode 100755 index 0000000..60fb333 --- /dev/null +++ b/caffeinemark/execute.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +#need to be defined for different benchmark apks +activity="com.flexycore.caffeinemark/.Application" +apk_file_name="com.flexycore.caffeinemark-1.apk" +test_method="python vc.py" +apk_package="com.flexycore.caffeinemark" + +#following should no need to modify +parent_dir=`dirname ${0}` +source "${parent_dir}/../common/common.sh" +main "$@" diff --git a/caffeinemark/session.xml b/caffeinemark/session.xml new file mode 100644 index 0000000..6223cb6 --- /dev/null +++ b/caffeinemark/session.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="US-ASCII" ?> +<session version="1" title="CaffeineMark" target_path="@F" call_stack_unwinding="yes" parse_debug_info="yes" high_resolution="no" buffer_mode="streaming" sample_rate="normal" duration="0"> +</session> diff --git a/caffeinemark/vc.py b/caffeinemark/vc.py new file mode 100755 index 0000000..ab2b05f --- /dev/null +++ b/caffeinemark/vc.py @@ -0,0 +1,90 @@ +import re +import sys +import os +import time +from subprocess import call + +from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException + +parent_dir = os.path.realpath(os.path.dirname(__file__)) +f_output_result="%s/../common/output-test-result.sh" % parent_dir + +# Result collection for LAVA +debug_switcher = False +default_unit = 'points' +result = 'pass' + + +def collect_score(score_name, result, score, default_unit): + call([f_output_result, score_name, result, score, default_unit]) + + +kwargs1 = {'verbose': False, 'ignoresecuredevice': False} +device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) +kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True, 'compresseddump': False} +vc = ViewClient(device, serialno, **kwargs2) + +def dump_always(): + success = False + while not success: + try: + vc.dump() + success = True + except RuntimeError: + print("Got RuntimeError when call vc.dump()") + time.sleep(5) + except ValueError: + print("Got ValueError when call vc.dump()") + time.sleep(5) + +time.sleep(2) +dump_always() +start_button = vc.findViewByIdOrRaise("com.flexycore.caffeinemark:id/startButton") +start_button.touch() + +finished = False +while (not finished): + try: + dump_always() + vc.findViewByIdOrRaise("com.flexycore.caffeinemark:id/testResultsCellOneTitle") + finished = True + except ViewNotFoundException: + print("ViewNotFoundException when tried to find com.flexycore.caffeinemark:id/testResultsCellOneTitle") + pass + except RuntimeError as e: + print("RuntimeError when tried to find com.flexycore.caffeinemark:id/testResultsCellOneTitle") + pass +print "benchmark finished" + +total_score = vc.findViewByIdOrRaise("com.flexycore.caffeinemark:id/testResultEntryOverAllScore").getText() +collect_score("Caffeinemark-score", result, total_score, default_unit) + +details_button = vc.findViewByIdOrRaise("com.flexycore.caffeinemark:id/testResultsDetailsButton") +details_button.touch() + +time.sleep(2) +dump_always() + +sieve_name = vc.findViewByIdOrRaise("id/no_id/9").getText() +sieve_score = vc.findViewByIdOrRaise("id/no_id/10").getText() +collect_score("Caffeinemark-Sieve-score", result, sieve_score, default_unit) + +loop_name = vc.findViewByIdOrRaise("id/no_id/13").getText() +loop_score = vc.findViewByIdOrRaise("id/no_id/14").getText() +collect_score("Caffeinemark-Loop-score", result, loop_score, default_unit) + +logic_name = vc.findViewByIdOrRaise("id/no_id/17").getText() +logic_score = vc.findViewByIdOrRaise("id/no_id/18").getText() +collect_score("Caffeinemark-Collect-score", result, logic_score, default_unit) + +string_name = vc.findViewByIdOrRaise("id/no_id/21").getText() +string_score = vc.findViewByIdOrRaise("id/no_id/22").getText() +collect_score("Caffeinemark-String-score", result, string_score, default_unit) + +float_name = vc.findViewByIdOrRaise("id/no_id/25").getText() +float_score = vc.findViewByIdOrRaise("id/no_id/26").getText() +collect_score("Caffeinemark-Float-score", result, float_score, default_unit) + +method_name = vc.findViewByIdOrRaise("id/no_id/29").getText() +method_score = vc.findViewByIdOrRaise("id/no_id/30").getText() +collect_score("Caffeinemark-Method-score", result, method_score, default_unit) |