diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-10-09 12:59:39 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-10-09 12:59:39 +0100 |
commit | 2449dfccc4ca2a9e78271c9244c59a89af726f21 (patch) | |
tree | 1da3dc83ae00a34143fcd5ccfacf7c336e3688e5 /antutu3 | |
parent | 066796f6c8241d52de9ee33b058433b9f9c3e01d (diff) |
antutu3: added antutu 3 automation.
Tested on Juno only
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'antutu3')
-rwxr-xr-x | antutu3/execute.sh | 24 | ||||
-rw-r--r-- | antutu3/session.xml | 3 | ||||
-rw-r--r-- | antutu3/shared_prefs/com.antutu.ABenchMark_preferences.xml | 7 | ||||
-rw-r--r-- | antutu3/vc.py | 87 |
4 files changed, 121 insertions, 0 deletions
diff --git a/antutu3/execute.sh b/antutu3/execute.sh new file mode 100755 index 0000000..d665955 --- /dev/null +++ b/antutu3/execute.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#need to be defined for different benchmark apks +activity="com.antutu.ABenchMark/.ABenchMarkStart" +apk_file_name="antutu_benchmark_3.3.2.apk" +test_method="python vc.py" +apk_package="com.antutu.ABenchMark" + +function change_no_update(){ + user=`adb shell ls -l /data/data/|grep com.antutu.ABenchMark|cut -d \ -f 2` + user=`echo ${user}|sed 's/\r//'` + dir_prefs="/data/data/com.antutu.ABenchMark/shared_prefs" + adb push ${parent_dir}/shared_prefs "${dir_prefs}" + adb shell chown ${user}:${user} "${dir_prefs}" + adb shell chmod 700 "${dir_prefs}" + adb shell chown ${user}:${user} "${dir_prefs}/com.antutu.ABenchMark_preferences.xml" + adb shell chmod 660 "${dir_prefs}/com.antutu.ABenchMark_preferences.xml" +} + +#following should no need to modify +parent_dir=`dirname ${0}` +source "${parent_dir}/../common/common.sh" +post_install="change_no_update" +main "$@" diff --git a/antutu3/session.xml b/antutu3/session.xml new file mode 100644 index 0000000..7843358 --- /dev/null +++ b/antutu3/session.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="US-ASCII" ?> +<session version="1" title="Antutu" 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/antutu3/shared_prefs/com.antutu.ABenchMark_preferences.xml b/antutu3/shared_prefs/com.antutu.ABenchMark_preferences.xml new file mode 100644 index 0000000..8330df3 --- /dev/null +++ b/antutu3/shared_prefs/com.antutu.ABenchMark_preferences.xml @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8' standalone='yes' ?> +<map> + <int name="lastVersionCode" value="3322" /> + <string name="test_sdcard_path">/mnt/sdcard</string> + <boolean name="frist_start" value="false" /> + <boolean name="setting_update" value="false" /> +</map> diff --git a/antutu3/vc.py b/antutu3/vc.py new file mode 100644 index 0000000..da52a7f --- /dev/null +++ b/antutu3/vc.py @@ -0,0 +1,87 @@ +import re +import sys +import os +import time +from subprocess import call + +from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException + +kwargs1 = {'verbose': False, 'ignoresecuredevice': False} +device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) +kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True} +vc = ViewClient(device, serialno, **kwargs2) +time.sleep(5) +vc.dump(window='-1') + +# release info and upgrade dialog are not presented +# if there is no connection to Internet +try: + button_cancel = vc.findViewByIdOrRaise("android:id/button2") + button_cancel.touch() +except ViewNotFoundException: + pass + +try: + vc.dump(window='-1') + time.sleep(2) + button_ok = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/button_ok") + button_ok.touch() +except ViewNotFoundException: + pass + +time.sleep(2) +vc.dump(window='-1') +button_test = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/btn_test_now") +button_test.touch() + +#time.sleep(2) +#vc.dump(window='-1') +#button_start_test = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/button_test") +#button_start_test.touch() + +finished = False +while(not finished): + time.sleep(1) + try: + vc.dump(window='-1') + if vc.findViewById("com.antutu.ABenchMark:id/layoutScoresHeader"): + finished = True + except RuntimeError: + pass + +print "benchmark finished" + +# close unnecessary windows if they appear +for index in range(0, 3): + time.sleep(1) + vc.dump(window='-1') + if vc.findViewById("com.antutu.ABenchMark:id/num_1"): + break + else: + device.press('KEYCODE_BACK') + +time.sleep(2) +vc.dump(window='-1') +header = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/layoutScoresHeader") +if not vc.findViewById("com.antutu.ABenchMark:id/layoutScores"): + header.touch() + +time.sleep(2) +vc.dump(window='-1') +mem_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_mem") +cpu_int_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_int") +cpu_float_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_float") +twod_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_2d") +threed_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_3d") +db_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_db") +sd_write_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_sdw") +sd_read_score = vc.findViewByIdOrRaise("com.antutu.ABenchMark:id/text_sdr") + +call(['lava-test-case', '"AnTuTu 2.8.2 CPU Integer Score"', '--result', 'pass', '--measurement', cpu_int_score.getText()]) +call(['lava-test-case', '"AnTuTu 2.8.2 CPU Float Score"', '--result', 'pass', '--measurement', cpu_float_score.getText()]) +call(['lava-test-case', '"AnTuTu 2.8.2 2D Score"', '--result', 'pass', '--measurement', twod_score.getText().split(" ")[1]]) +call(['lava-test-case', '"AnTuTu 2.8.2 3D Score"', '--result', 'pass', '--measurement', threed_score.getText().split(" ")[1]]) +call(['lava-test-case', '"AnTuTu 2.8.2 Mem Score"', '--result', 'pass', '--measurement', mem_score.getText()]) +call(['lava-test-case', '"AnTuTu 2.8.2 DB Score"', '--result', 'pass', '--measurement', db_score.getText()]) +call(['lava-test-case', '"AnTuTu 2.8.2 SD Write Score"', '--result', 'pass', '--measurement', sd_write_score.getText()]) +call(['lava-test-case', '"AnTuTu 2.8.2 SD Read Score"', '--result', 'pass', '--measurement', sd_write_score.getText()]) |