diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2016-11-08 07:49:58 +0000 |
---|---|---|
committer | Linaro Code Review <review@review.linaro.org> | 2016-11-08 07:49:58 +0000 |
commit | 3640be3c39fbf797ca7050c7ec14d48d406f79c0 (patch) | |
tree | 81feedc2aba591e94a538bf89f71d2df04d5e930 | |
parent | 7470d7bb45f08594d1cf1aa13882bcfecc7a02a4 (diff) | |
parent | a50446487026f5e25a511d824909962eeabf8140 (diff) |
Merge "antutu6.0/vc.py: improvement to support x15"
-rwxr-xr-x | antutu6.0/vc.py | 124 |
1 files changed, 80 insertions, 44 deletions
diff --git a/antutu6.0/vc.py b/antutu6.0/vc.py index 4db598a..11743fc 100755 --- a/antutu6.0/vc.py +++ b/antutu6.0/vc.py @@ -33,48 +33,87 @@ def dump_always(): time.sleep(5) -def parse_result(item): +test_items = [u'3D', u'UX', u'CPU', u'RAM'] +test_subitems = { + u'3D' : [u'3D [Garden]', u'3D [Marooned]'], + u'UX' : [u'UX Data Secure', u'UX Data process', u'UX Strategy games', u'UX Image process', u'UX I/O performance'], + u'CPU' : [u'CPU Mathematics', u'CPU Common Use', u'CPU Multi-Core'], + u'RAM' : [] +} + +def parse_result(): global antutu_sum - find_view = False - while not find_view: - dump_always() - id_str = "com.antutu.ABenchMark:id/hcf_%s" % item.lower() - id_root = vc.findViewById(id_str) - if id_root: - id_root.touch() - find_view = True - - dump_always() - root = vc.findViewByIdOrRaise(id_str) - score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/tv_score_value", - root).getText().strip() - try: - score = int(score) - call([f_output_result, "antutu6_%s" % item.upper(), 'pass', str(score), 'points']) - antutu_sum = antutu_sum + int(score) - except ValueError: - call([f_output_result, "antutu6_%s" % item.upper(), 'faile']) - - subitems = vc.findViewById("com.antutu.ABenchMark:id/lv_child_item", - root) - if not subitems: - return - for ch in subitems.children: - subitem_key = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/tv_key", - ch).getText().strip() - subitem_key = subitem_key.replace("[", '').replace("]", '') - subitem_key = subitem_key.replace("/", '') - subitem_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:" - "id/tv_value", - ch).getText().strip() - try: - subitem_score = int(subitem_score) - call([f_output_result, "antutu6_%s" % subitem_key, - 'pass', str(subitem_score), 'points']) - except ValueError: - call([f_output_result, "antutu6_%s" % subitem_key, 'fail']) - + for item in test_items: + print("Try to find result for test suite: %s" % item) + found_view = False + while not found_view: + dump_always() + id_root = vc.findViewWithText(item) + if id_root: + print("Found result id_root for test suite: %s" % item) + found_view = True + else: + dump_always() + print("Press DPAD_DOWN to find %s item" % item) + device.press('DPAD_DOWN') + time.sleep(2) + + print("Try to find the score value for test suite:%s" % item) + # Try to find the score for that item + found_view = False + while not found_view: + dump_always() + id_root = vc.findViewWithText(item) + score_view = vc.findViewById("com.antutu.ABenchMark:id/tv_score_value", + id_root.getParent()) + if score_view: + score = score_view.getText().strip() + try: + score = int(score) + call([f_output_result, "antutu6_%s" % item.upper(), 'pass', str(score), 'points']) + antutu_sum = antutu_sum + int(score) + except ValueError: + call([f_output_result, "antutu6_%s" % item.upper(), 'fail']) + + found_view = True + arrow_icon = vc.findViewById("com.antutu.ABenchMark:id/iv_arrow", id_root.getParent()) + if arrow_icon: + arrow_icon.touch() + + print("Found score value for test suite: %s: %s" % (item, score)) + + else: + print("Press DPAD_DOWN to find %s item value" % item.lower()) + device.press('DPAD_DOWN') + time.sleep(2) + + + for sub_item in test_subitems[item]: + + print("Try to find score value for sub item: %s" % sub_item) + found_view = False + while not found_view: + dump_always() + subitem_obj = vc.findViewWithText(sub_item) + if subitem_obj: + subitem_value_obj = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/tv_value", subitem_obj.getParent()) + subitem_key = sub_item.replace("[", '').replace("]", '') + subitem_key = subitem_key.replace("/", '') + subitem_score = subitem_value_obj.getText().strip() + try: + subitem_score = int(subitem_score) + call([f_output_result, "antutu6_%s" % subitem_key, + 'pass', str(subitem_score), 'points']) + except ValueError: + call([f_output_result, "antutu6_%s" % subitem_key, 'fail']) + + found_view = True + print("Found score value for sub itme: %s : %s" % (sub_item, subitem_score)) + else: + print("Press DPAD_DOWN to find sub item: %s" % sub_item) + device.press('DPAD_DOWN') + time.sleep(2) def main(): #Enable 64-bit @@ -119,10 +158,7 @@ def main(): if allow_permission_btn: allow_permission_btn.touch() - parse_result("ram") - parse_result("cpu") - parse_result("ux") - parse_result("3d") + parse_result() call([f_output_result, "antutu6_total", 'pass', str(antutu_sum), 'points']) |