From 8290db4a9bdada832810ae190c2378942003319b Mon Sep 17 00:00:00 2001 From: Yongqin Liu Date: Tue, 14 Apr 2015 21:06:13 +0800 Subject: antutu5.7: change to use the antutu5.7 as the latest version Since Antutu5.7 is on the playstore now, and Antutu5.6.2 is just added into the repository several days before. So here delete the scripts for Andtutu5.6.2, and add the scripts for Antutu5.7 Change-Id: I1e5a3041ac37c2c2254246965de4b65ad0aa05dd Signed-off-by: Yongqin Liu --- antutu5.6.2/execute.sh | 39 -------- antutu5.6.2/vc.py | 238 -------------------------------------------- antutu5.7/execute.sh | 39 ++++++++ antutu5.7/vc.py | 261 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 300 insertions(+), 277 deletions(-) delete mode 100755 antutu5.6.2/execute.sh delete mode 100755 antutu5.6.2/vc.py create mode 100755 antutu5.7/execute.sh create mode 100755 antutu5.7/vc.py diff --git a/antutu5.6.2/execute.sh b/antutu5.6.2/execute.sh deleted file mode 100755 index 1fedc17..0000000 --- a/antutu5.6.2/execute.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -#need to be defined for different benchmark apks -activity="com.antutu.ABenchMark/.ABenchMarkStart" -apk_file_name="AnTuTuBenchmark5.6.2.apk" -test_method="python vc.py" -apk_package="com.antutu.ABenchMark" -antutu562_64bit_apk_name="AnTuTu_Benchmark_64-bit_5.6.apk" - -#following should no need to modify -parent_dir=`dirname ${0}` -source "${parent_dir}/../common/common.sh" - -func_post_uninstall_antutu562(){ - package_64bit="com.antutu.benchmark.bench64" - func_kill_uninstall "${antutu562_64bit_apk_name}" "${package_64bit}" -} - -func_post_install_antutu562(){ - package_64bit="com.antutu.benchmark.bench64" - func_kill_uninstall "${antutu562_64bit_apk_name}" "${package_64bit}" - if adb shell getprop ro.product.cpu.abilist |grep -q "arm64-v8a"; then - if get_file_with_base_url "${antutu562_64bit_apk_name}" "${BASE_URL}" "${D_APKS}"; then - adb install -r "${D_APKS}/${antutu562_64bit_apk_name}" - if [ $? -ne 0 ]; then - echo "Failed to install ${antutu562_64bit_apk_name}." - return 1 - fi - else - echo "Failed to get ${antutu562_64bit_apk_name}." - return 1 - fi - - fi -} -post_uninstall="func_post_uninstall_antutu562" -post_install="func_post_install_antutu562" -timeout="20m" -main "$@" diff --git a/antutu5.6.2/vc.py b/antutu5.6.2/vc.py deleted file mode 100755 index 9ee057e..0000000 --- a/antutu5.6.2/vc.py +++ /dev/null @@ -1,238 +0,0 @@ -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 - - -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) - - -def switch_arch(): - dump_always() - settings_button = vc.findViewById("com.antutu.ABenchMark:id/right_action_layout") - if settings_button: - settings_button.touch() - time.sleep(2) - dump_always() - switch_to_32bit_btn = vc.findViewWithText(u'Switch to 32-bit') - switch_to_64bit_btn = vc.findViewWithText(u'Switch to 64-bit') - switch_btn = None - if switch_to_64bit_btn: - prefix = "64bit" - switch_btn = switch_to_64bit_btn - elif switch_to_32bit_btn: - prefix = "32bit" - switch_btn = switch_to_32bit_btn - else: - prefix = "32bit" - switch_btn = None - - if switch_btn: - switch_btn.touch() - can_switch = True - else: - device.press("BACK") - can_switch = False - else: - prefix = "32bit" - can_switch = False - - return (prefix, can_switch) - - -def run_test(prefix=""): - - #Start all test button - time.sleep(2) - dump_always() - start_test_button = vc.findViewById("com.antutu.ABenchMark:id/start_test_text") - if start_test_button: - start_test_button.touch() - else: - retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_text") - retest_btn.touch() - time.sleep(2) - dump_always() - retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_btn") - retest_btn.touch() - - time.sleep(5) - - #Wait while antutu5.6.2 is running benchmark - to_detail = False - while(not to_detail): - try: - time.sleep(5) - dump_always() - detail_btn = vc.findViewById("com.antutu.ABenchMark:id/detail_btn") - if detail_btn: - detail_btn.touch() - to_detail = True - print("Found the Details button, the test should be run successfully") - elif vc.findViewWithText('Unfortunately, AnTuTu Benchmark has stopped.'): - ok_btn = vc.findViewWithTextOrRaise(u'OK') - ok_btn.touch() - elif vc.findViewWithText('Benchmarking has stopped unexpectedly. Please try again!'): - ok_btn = vc.findViewWithTextOrRaise(u'OK') - ok_btn.touch() - retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_text") - retest_btn.touch() - time.sleep(2) - dump_always() - retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_btn") - retest_btn.touch() - else: - # seems not sure? this seems start a new test again - start_test_button = vc.findViewById("com.antutu.ABenchMark:id/start_test_region") - if start_test_button: - start_test_button.touch() - to_detail = True - print("Found the Test button again, the test might not be run successfully, or no network connection") - except ViewNotFoundException: - print("Got ViewNotFoundException when go to the detail page while waiting for test finished") - except RuntimeError: - print("Got RuntimeError when go to the detail page while waiting for test finished") - except ValueError: - print("Got ValueError when go to the detail page while waiting for test finished") - - find_detail = False - while not find_detail: - try: - time.sleep(2) - dump_always() - vc.findViewWithTextOrRaise('Details - v5.6.2') - close_view = vc.findViewById("com.antutu.ABenchMark:id/close_img_view") - if close_view: - close_view.touch() - find_detail = True - print("Changed to the detail page successfully") - get_result(prefix=prefix) - except ViewNotFoundException: - print("Got ViewNotFoundException when on the details page") - except RuntimeError: - print("Got RuntimeError when on the details page") - except ValueError: - print("Got ValueError when on the details page") - - -def get_result(prefix=""): - if prefix: - prefix = "%s_" % prefix - #Get the score - dump_always() - multitask_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ue_multitask_text") - multitask_score = multitask_view.getText().strip() - call([f_output_result, "%santutu_5_6_2_ue_multitask" % prefix, 'pass', multitask_score, 'points']) - - runtime_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ue_dalvik_text") - runtime_score = runtime_view.getText().strip() - call([f_output_result, "%santutu_5_6_2_ue_runtime" % prefix, 'pass', runtime_score, 'points']) - - cpu_multi_integer_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_int_text") - cpu_multi_integer_score = cpu_multi_integer_view.getText().strip() - call([f_output_result, "%santutu_5_6_2_cpu_integer" % prefix, 'pass', cpu_multi_integer_score, 'points']) - - cpu_multi_float_point_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_float_text") - cpu_multi_float_point_score = cpu_multi_float_point_view.getText().strip() - call([f_output_result, "%santutu_5_6_2_cpu_float_point" % prefix, 'pass', cpu_multi_float_point_score, 'points']) - - device.press('DPAD_DOWN') - time.sleep(2) - device.press('DPAD_DOWN') - time.sleep(2) - dump_always() - - cpu_single_integer_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_int_text2") - call([f_output_result, "%santutu_5_6_2_single_thread_integer" % prefix, 'pass', cpu_single_integer_score.getText().strip(), 'points']) - - cpu_single_float_point_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_float_text2") - call([f_output_result, "%santutu_5_6_2_single_float_point" % prefix, 'pass', cpu_single_float_point_score.getText().strip(), 'points']) - - ram_operation_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/mem_text") - call([f_output_result, "%santutu_5_6_2_single_ram_operation" % prefix, 'pass', ram_operation_score.getText().strip(), 'points']) - - ram_speed_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ram_text") - call([f_output_result, "%santutu_5_6_2_single_ram_speed" % prefix, 'pass', ram_speed_score.getText().strip(), 'points']) - - twod_graphics_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/gpu_2d_text") - call([f_output_result, "%santutu_5_6_2_2D_graphics" % prefix, 'pass', twod_graphics_score.getText().strip(), 'points']) - - threed_graphics_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/gpu_3d_text") - score_3d = threed_graphics_score.getText().strip() - call([f_output_result, "%santutu_5_6_2_3D_graphics" % prefix, 'pass', score_3d.split(" ").pop(), 'points']) - - storage_io_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/io_sdw_text") - call([f_output_result, "%santutu_5_6_2_storage_io" % prefix, 'pass', storage_io_score.getText().strip(), 'points']) - - database_io_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/io_db_text") - call([f_output_result, "%santutu_5_6_2_database_io" % prefix, 'pass', database_io_score.getText().strip(), 'points']) - - -def main(): - #Enable 64-bit - time.sleep(10) - dump_always() - win_enable64 = vc.findViewWithText(u'Enable 64-bit') - if win_enable64: - enable_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/btn_ok") - enable_btn.touch() - time.sleep(10) - dump_always() - install_btn = vc.findViewById("com.android.packageinstaller:id/ok_button") - if install_btn: - install_btn.touch() - time.sleep(10) - dump_always() - done_btn = vc.findViewById("com.android.packageinstaller:id/done_button") - if done_btn: - done_btn.touch() - time.sleep(5) - - prefix, switch = switch_arch() - run_test(prefix=prefix) - if switch: - dump_always() - return_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/v_top_left") - return_btn.touch() - - time.sleep(2) - dump_always() - return_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/v_top_left") - return_btn.touch() - - time.sleep(2) - dump_always() - rating_window = vc.findViewById("com.antutu.ABenchMark:id/rating_title_tv") - if rating_window: - not_btn = vc.findViewWithTextOrRaise(u'NOT NOW') - not_btn.touch() - - prefix, switch = switch_arch() - run_test(prefix=prefix) - - -if __name__ == '__main__': - main() diff --git a/antutu5.7/execute.sh b/antutu5.7/execute.sh new file mode 100755 index 0000000..aae4d0d --- /dev/null +++ b/antutu5.7/execute.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +#need to be defined for different benchmark apks +activity="com.antutu.ABenchMark/.ABenchMarkStart" +apk_file_name="Antutu5.7.apk" +test_method="python vc.py" +apk_package="com.antutu.ABenchMark" +antutu562_64bit_apk_name="AnTuTu_Benchmark_64-bit_5.6.apk" + +#following should no need to modify +parent_dir=`dirname ${0}` +source "${parent_dir}/../common/common.sh" + +func_post_uninstall_antutu562(){ + package_64bit="com.antutu.benchmark.bench64" + func_kill_uninstall "${antutu562_64bit_apk_name}" "${package_64bit}" +} + +func_post_install_antutu562(){ + package_64bit="com.antutu.benchmark.bench64" + func_kill_uninstall "${antutu562_64bit_apk_name}" "${package_64bit}" + if adb shell getprop ro.product.cpu.abilist |grep -q "arm64-v8a"; then + if get_file_with_base_url "${antutu562_64bit_apk_name}" "${BASE_URL}" "${D_APKS}"; then + adb install -r "${D_APKS}/${antutu562_64bit_apk_name}" + if [ $? -ne 0 ]; then + echo "Failed to install ${antutu562_64bit_apk_name}." + return 1 + fi + else + echo "Failed to get ${antutu562_64bit_apk_name}." + return 1 + fi + + fi +} +post_uninstall="func_post_uninstall_antutu562" +post_install="func_post_install_antutu562" +timeout="20m" +main "$@" diff --git a/antutu5.7/vc.py b/antutu5.7/vc.py new file mode 100755 index 0000000..db2996e --- /dev/null +++ b/antutu5.7/vc.py @@ -0,0 +1,261 @@ +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 + + +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) + + +def switch_arch(): + dump_always() + settings_button = vc.findViewById("com.antutu.ABenchMark:id/right_action_layout") + if settings_button: + settings_button.touch() + time.sleep(2) + dump_always() + switch_to_32bit_btn = vc.findViewWithText(u'Switch to 32-bit') + switch_to_64bit_btn = vc.findViewWithText(u'Switch to 64-bit') + switch_btn = None + if switch_to_64bit_btn: + prefix = "64bit" + switch_btn = switch_to_64bit_btn + elif switch_to_32bit_btn: + prefix = "32bit" + switch_btn = switch_to_32bit_btn + else: + prefix = "32bit" + switch_btn = None + + if switch_btn: + switch_btn.touch() + can_switch = True + else: + device.press("BACK") + can_switch = False + else: + prefix = "32bit" + can_switch = False + + return (prefix, can_switch) + + +def run_test(prefix=""): + + #Start all test button + time.sleep(2) + dump_always() + start_test_button = vc.findViewById("com.antutu.ABenchMark:id/start_test_text") + if start_test_button: + start_test_button.touch() + else: + retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_text") + retest_btn.touch() + time.sleep(2) + dump_always() + retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_btn") + retest_btn.touch() + + time.sleep(5) + + #Wait while antutu5.6.2 is running benchmark + to_detail = False + while(not to_detail): + try: + time.sleep(30) + dump_always() + if vc.findViewWithText('Details - v5.7'): + to_detail = True + print("Already in the details page") + elif vc.findViewById("com.antutu.ABenchMark:id/detail_btn"): + detail_btn = vc.findViewById("com.antutu.ABenchMark:id/detail_btn") + detail_btn.touch() + to_detail = True + print("Found the Details button, the test should be run successfully") + elif vc.findViewWithText('Unfortunately, AnTuTu Benchmark has stopped.'): + ok_btn = vc.findViewWithTextOrRaise(u'OK') + ok_btn.touch() + print("Closed the 'Unfortunately, AnTuTu Benchmark has stopped.' dialog.") + elif vc.findViewWithText('Benchmarking has stopped unexpectedly. Please try again!'): + ok_btn = vc.findViewWithTextOrRaise(u'OK') + ok_btn.touch() + dump_always() + retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_text") + retest_btn.touch() + time.sleep(2) + dump_always() + retest_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/retest_btn") + retest_btn.touch() + print("Benchmarking has stopped unexpectedly, restart again") + elif vc.findViewById("com.antutu.ABenchMark:id/start_test_region"): + # seems not sure? this seems start a new test again + start_test_button = vc.findViewById("com.antutu.ABenchMark:id/start_test_region") + start_test_button.touch() + to_detail = True + print("Found the Test button again, the test might not be run successfully, or no network connection") + else: + print("Wait for conditions to go to details page") + + except ViewNotFoundException: + print("Got ViewNotFoundException when go to the detail page while waiting for test finished") + except RuntimeError: + print("Got RuntimeError when go to the detail page while waiting for test finished") + except ValueError: + print("Got ValueError when go to the detail page while waiting for test finished") + + find_detail = False + while not find_detail: + try: + time.sleep(2) + dump_always() + vc.findViewWithTextOrRaise('Details - v5.7') + close_view = vc.findViewById("com.antutu.ABenchMark:id/close_img_view") + if close_view: + close_view.touch() + find_detail = True + print("Changed to the detail page successfully") + get_result(prefix=prefix) + except ViewNotFoundException: + print("Got ViewNotFoundException when on the details page") + except RuntimeError: + print("Got RuntimeError when on the details page") + except ValueError: + print("Got ValueError when on the details page") + + +def get_result(prefix=""): + if prefix: + prefix = "%s_" % prefix + #Get the score + antutu_sum = 0; + dump_always() + multitask_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ue_multitask_text") + multitask_score = multitask_view.getText().strip() + call([f_output_result, "%santutu_ue_multitask" % prefix, 'pass', multitask_score, 'points']) + antutu_sum = antutu_sum + int(multitask_score) + + runtime_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ue_dalvik_text") + runtime_score = runtime_view.getText().strip() + call([f_output_result, "%santutu_ue_runtime" % prefix, 'pass', runtime_score, 'points']) + antutu_sum = antutu_sum + int(runtime_score) + + cpu_multi_integer_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_int_text") + cpu_multi_integer_score = cpu_multi_integer_view.getText().strip() + call([f_output_result, "%santutu_cpu_integer" % prefix, 'pass', cpu_multi_integer_score, 'points']) + antutu_sum = antutu_sum + int(cpu_multi_integer_score) + + cpu_multi_float_point_view = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_float_text") + cpu_multi_float_point_score = cpu_multi_float_point_view.getText().strip() + call([f_output_result, "%santutu_cpu_float_point" % prefix, 'pass', cpu_multi_float_point_score, 'points']) + antutu_sum = antutu_sum + int(cpu_multi_float_point_score) + + device.press('DPAD_DOWN') + time.sleep(2) + device.press('DPAD_DOWN') + time.sleep(2) + dump_always() + + cpu_single_integer_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_int_text2") + call([f_output_result, "%santutu_single_thread_integer" % prefix, 'pass', cpu_single_integer_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(cpu_single_integer_score.getText().strip()) + + cpu_single_float_point_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/cpu_float_text2") + call([f_output_result, "%santutu_single_float_point" % prefix, 'pass', cpu_single_float_point_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(cpu_single_float_point_score.getText().strip()) + + ram_operation_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/mem_text") + call([f_output_result, "%santutu_single_ram_operation" % prefix, 'pass', ram_operation_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(ram_operation_score.getText().strip()) + + ram_speed_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/ram_text") + call([f_output_result, "%santutu_single_ram_speed" % prefix, 'pass', ram_speed_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(ram_speed_score.getText().strip()) + + twod_graphics_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/gpu_2d_text") + call([f_output_result, "%santutu_2D_graphics" % prefix, 'pass', twod_graphics_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(twod_graphics_score.getText().strip()) + + threed_graphics_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/gpu_3d_text") + score_3d = threed_graphics_score.getText().strip() + call([f_output_result, "%santutu_3D_graphics" % prefix, 'pass', score_3d.split(" ").pop(), 'points']) + antutu_sum = antutu_sum + int(score_3d.split(" ").pop()) + + storage_io_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/io_sdw_text") + call([f_output_result, "%santutu_storage_io" % prefix, 'pass', storage_io_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(storage_io_score.getText().strip()) + + database_io_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/io_db_text") + call([f_output_result, "%santutu_database_io" % prefix, 'pass', database_io_score.getText().strip(), 'points']) + antutu_sum = antutu_sum + int(database_io_score.getText().strip()) + + call([f_output_result, "%santutu_total" % prefix, 'pass', str(antutu_sum), 'points']) + + +def main(): + #Enable 64-bit + time.sleep(10) + dump_always() + win_enable64 = vc.findViewWithText(u'Enable 64-bit') + if win_enable64: + enable_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/btn_ok") + enable_btn.touch() + time.sleep(10) + dump_always() + install_btn = vc.findViewById("com.android.packageinstaller:id/ok_button") + if install_btn: + install_btn.touch() + time.sleep(10) + dump_always() + done_btn = vc.findViewById("com.android.packageinstaller:id/done_button") + if done_btn: + done_btn.touch() + time.sleep(5) + + prefix, switch = switch_arch() + run_test(prefix=prefix) + if switch: + dump_always() + return_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/v_top_left") + return_btn.touch() + + time.sleep(2) + dump_always() + return_btn = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/v_top_left") + return_btn.touch() + + time.sleep(2) + dump_always() + rating_window = vc.findViewById("com.antutu.ABenchMark:id/rating_title_tv") + if rating_window: + not_btn = vc.findViewWithTextOrRaise(u'NOT NOW') + not_btn.touch() + + prefix, switch = switch_arch() + run_test(prefix=prefix) + + +if __name__ == '__main__': + main() -- cgit v1.2.3