aboutsummaryrefslogtreecommitdiff
path: root/automated/android
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2020-07-24 14:59:53 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2020-07-29 19:54:25 +0800
commitdb5f7c0431b7715d83604250dbe6cc09c391b434 (patch)
tree9e7ffa6ee5c7d593b20bd176beb543a6e96d9a6f /automated/android
parent51173ac5566b9ebfdcbe21784ac06de39206ded0 (diff)
apk-automation: update to work with aosp master branch
Tested locally with hikey960 aosp-master-throttled-copped#6640860 build Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'automated/android')
-rwxr-xr-xautomated/android/apk-automation/andebenchpro2015.py12
-rwxr-xr-xautomated/android/apk-automation/antutu6.py23
-rwxr-xr-xautomated/android/apk-automation/apk-automation.sh12
-rw-r--r--automated/android/apk-automation/apk-automation.yaml4
-rwxr-xr-xautomated/android/apk-automation/benchmarkpi.py3
-rwxr-xr-xautomated/android/apk-automation/caffeinemark.py3
-rwxr-xr-xautomated/android/apk-automation/cf-bench.py3
-rwxr-xr-xautomated/android/apk-automation/common/__init__.py12
-rwxr-xr-xautomated/android/apk-automation/glbenchmark25.py12
-rwxr-xr-xautomated/android/apk-automation/jbench.py22
-rwxr-xr-xautomated/android/apk-automation/linpack.py3
-rwxr-xr-xautomated/android/apk-automation/main.py2
-rwxr-xr-xautomated/android/apk-automation/quadrantpro.py10
-rwxr-xr-xautomated/android/apk-automation/scimark.py19
-rwxr-xr-xautomated/android/apk-automation/vellamo3.py8
15 files changed, 122 insertions, 26 deletions
diff --git a/automated/android/apk-automation/andebenchpro2015.py b/automated/android/apk-automation/andebenchpro2015.py
index 909f279..43b7210 100755
--- a/automated/android/apk-automation/andebenchpro2015.py
+++ b/automated/android/apk-automation/andebenchpro2015.py
@@ -81,6 +81,18 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(10)
self.dump_always()
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
+ if continue_btn:
+ continue_btn.touch()
+
+ self.dump_always()
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ if warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+
+ self.dump_always()
btn_license = self.vc.findViewWithText(u'I Agree')
if btn_license:
btn_license.touch()
diff --git a/automated/android/apk-automation/antutu6.py b/automated/android/apk-automation/antutu6.py
index 381bc4a..2ff4f53 100755
--- a/automated/android/apk-automation/antutu6.py
+++ b/automated/android/apk-automation/antutu6.py
@@ -123,19 +123,22 @@ class ApkRunnerImpl(ApkTestRunner):
btn_ok.touch()
# cancel the update
- update_msg = "New update available"
- update_window = self.vc.findViewWithText(update_msg)
+ update_window = self.vc.findViewWithText("New update available")
+ need_permission_msg = self.vc.findViewWithText("Please allow the permissions we need for test")
+ allow_permission_btn = self.vc.findViewWithText('ALLOW')
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if update_window:
btn_cancel = self.vc.findViewWithTextOrRaise(u'Cancel')
btn_cancel.touch()
-
- msg = "Please allow the permissions we need for test"
- need_permission_msg = self.vc.findViewWithText(msg)
- if need_permission_msg:
+ elif need_permission_msg:
btn_ok = self.vc.findViewWithTextOrRaise(u'OK')
btn_ok.touch()
-
- allow_permission_btn = self.vc.findViewById('com.android.packageinstaller'
- ':id/permission_allow_button')
- if allow_permission_btn:
+ elif allow_permission_btn:
allow_permission_btn.touch()
+ elif warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
diff --git a/automated/android/apk-automation/apk-automation.sh b/automated/android/apk-automation/apk-automation.sh
index 937b956..f5bda12 100755
--- a/automated/android/apk-automation/apk-automation.sh
+++ b/automated/android/apk-automation/apk-automation.sh
@@ -5,6 +5,7 @@
. ./../../lib/android-test-lib
SKIP_INSTALL="true"
+SET_GOVERNOR_POLICY=true
ANDROID_SERIAL=""
BOOT_TIMEOUT="300"
LOOPS="1"
@@ -13,11 +14,11 @@ APK_DIR="./apks"
BASE_URL="http://testdata.validation.linaro.org/apks/"
usage() {
- echo "Usage: $0 [-S <true|false>] [-s <serialno>] [-t <timeout>] [-l <loops>] [-n <test_name>] [-d <apk_dir>] ['-u <base_url>']" 1>&2
+ echo "Usage: $0 [-S <true|false>] [-s <serialno>] [-t <timeout>] [-l <loops>] [-n <test_name>] [-d <apk_dir>] ['-u <base_url>'] [ -g <true|false>]" 1>&2
exit 1
}
-while getopts ":S:s:t:l:n:d:u:" opt; do
+while getopts ":S:s:t:l:n:d:u:g:" opt; do
case "${opt}" in
S) SKIP_INSTALL="${OPTARG}" ;;
s) ANDROID_SERIAL="${OPTARG}" ;;
@@ -26,6 +27,7 @@ while getopts ":S:s:t:l:n:d:u:" opt; do
n) TEST_NAME="${OPTARG}" ;;
d) APK_DIR="${OPTARG}" ;;
u) BASE_URL="${OPTARG}" ;;
+ g) SET_GOVERNOR_POLICY="${OPTARG}" ;;
*) usage ;;
esac
done
@@ -53,4 +55,8 @@ wait_boot_completed "${BOOT_TIMEOUT}"
disable_suspend
info_msg "device-${ANDROID_SERIAL}: About to run ${TEST_NAME}..."
-python main.py -l "${LOOPS}" -n "${TEST_NAME}" -d "${APK_DIR}" -u "${BASE_URL}"
+option_g="-g"
+if [ -n "${SET_GOVERNOR_POLICY}" ] && [ "X${SET_GOVERNOR_POLICY}" = "Xfalse" ]; then
+ option_g=""
+fi
+python main.py -l "${LOOPS}" -n "${TEST_NAME}" -d "${APK_DIR}" -u "${BASE_URL}" ${option_g}
diff --git a/automated/android/apk-automation/apk-automation.yaml b/automated/android/apk-automation/apk-automation.yaml
index 4b6d32c..805e8eb 100644
--- a/automated/android/apk-automation/apk-automation.yaml
+++ b/automated/android/apk-automation/apk-automation.yaml
@@ -16,6 +16,8 @@ metadata:
params:
SKIP_INSTALL: "false"
+ # specify if to set the governor policy
+ SET_GOVERNOR_POLICY: "true"
# Timeout for wait_boot_completed in seconds.
BOOT_TIMEOUT: "300"
# Specify adb device SN if more then one device connected.
@@ -34,7 +36,7 @@ params:
run:
steps:
- cd ./automated/android/apk-automation
- - ./apk-automation.sh -S "${SKIP_INSTALL}" -t "${BOOT_TIMEOUT}" -s "${ANDROID_SERIAL}" -n "${TEST_NAME}" -l "${LOOPS}" -d "${APK_DIR}" -u "${BASE_URL}"
+ - ./apk-automation.sh -S "${SKIP_INSTALL}" -t "${BOOT_TIMEOUT}" -s "${ANDROID_SERIAL}" -n "${TEST_NAME}" -l "${LOOPS}" -d "${APK_DIR}" -u "${BASE_URL}" -g "${SET_GOVERNOR_POLICY}"
# Upload test output to artifactorial.
- cp "./output/${TEST_NAME}/result.txt" "./output/result.txt"
- tar caf "output-${TEST_NAME}.tar.xz" "./output"
diff --git a/automated/android/apk-automation/benchmarkpi.py b/automated/android/apk-automation/benchmarkpi.py
index 41a70ec..e1d444b 100755
--- a/automated/android/apk-automation/benchmarkpi.py
+++ b/automated/android/apk-automation/benchmarkpi.py
@@ -18,10 +18,13 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(2)
self.dump_always()
warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if warn_msg:
self.logger.info("Older version warning popped up")
warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
else:
start_button = self.vc.findViewByIdOrRaise("gr.androiddev.BenchmarkPi:id/Button01")
start_button.touch()
diff --git a/automated/android/apk-automation/caffeinemark.py b/automated/android/apk-automation/caffeinemark.py
index 22ce5e2..cf0f5a4 100755
--- a/automated/android/apk-automation/caffeinemark.py
+++ b/automated/android/apk-automation/caffeinemark.py
@@ -25,10 +25,13 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(2)
self.dump_always()
warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if warn_msg:
self.logger.info("Older version warning popped up")
warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
else:
start_button = self.vc.findViewByIdOrRaise("com.flexycore.caffeinemark:id/startButton")
start_button.touch()
diff --git a/automated/android/apk-automation/cf-bench.py b/automated/android/apk-automation/cf-bench.py
index c777157..f6646dd 100755
--- a/automated/android/apk-automation/cf-bench.py
+++ b/automated/android/apk-automation/cf-bench.py
@@ -19,10 +19,13 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(2)
self.dump_always()
warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if warn_msg:
self.logger.info("Older version warning popped up")
warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
else:
# Start test button
start_button = self.vc.findViewWithTextOrRaise("Full Benchmark")
diff --git a/automated/android/apk-automation/common/__init__.py b/automated/android/apk-automation/common/__init__.py
index f000ac8..db68292 100755
--- a/automated/android/apk-automation/common/__init__.py
+++ b/automated/android/apk-automation/common/__init__.py
@@ -12,7 +12,7 @@ import time
try:
import urlparse
except ImportError:
- from urllib.parse import urlparse
+ from urllib import parse as urlparse
from com.dtmilano.android.viewclient import ViewClient
@@ -240,7 +240,7 @@ class ApkTestRunner(object):
def uninstall_apk(self, package):
install_packages = subprocess.check_output(['adb', 'shell', 'pm', 'list', 'packages'])
- if package in install_packages:
+ if package in str(install_packages):
self.logger.info('Stopping %s' % package)
self.call_adb("shell am force-stop %s" % package)
@@ -260,6 +260,10 @@ class ApkTestRunner(object):
self.call_adb('shell dmesg > %s/dmesg.log' % self.config['output'])
def set_performance_governor(self, target_governor="performance"):
+ if self.config.get('set_governor_policy') is not None \
+ and self.config.get('set_governor_policy') is False:
+ return
+
f_scaling_governor = ('/sys/devices/system/cpu/'
'cpu0/cpufreq/scaling_governor')
f_governor_backup = '/data/local/tmp/scaling_governor'
@@ -280,6 +284,10 @@ class ApkTestRunner(object):
cpu.strip()))
def set_back_governor(self):
+ if self.config.get('set_governor_policy') is not None \
+ and self.config.get('set_governor_policy') is False:
+ return
+
dir_sys_cpu = '/sys/devices/system/cpu/'
f_governor_backup = '/data/local/tmp/scaling_governor'
f_governor_local = os.path.join(os.path.abspath(self.config['output']),
diff --git a/automated/android/apk-automation/glbenchmark25.py b/automated/android/apk-automation/glbenchmark25.py
index 9853a84..22e4410 100755
--- a/automated/android/apk-automation/glbenchmark25.py
+++ b/automated/android/apk-automation/glbenchmark25.py
@@ -1,3 +1,4 @@
+import sys
import time
import xml.dom.minidom
from common import ApkTestRunner
@@ -13,7 +14,7 @@ class ApkRunnerImpl(ApkTestRunner):
def setUp(self):
# set to peformance governor policay
- self.set_performance_governor()
+ # self.set_performance_governor()
# download apk related files
self.download_apk('main.1.com.glbenchmark.glbenchmark25.obb')
self.download_apk(self.config['apk_file_name'])
@@ -42,6 +43,9 @@ class ApkRunnerImpl(ApkTestRunner):
select_all_btn = self.vc.findViewWithText("All")
display_tests_menu = self.vc.findViewWithText("Performance Tests")
warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
+ attention_msg = self.vc.findViewWithText(u'''Network connection not found!
+Do you want to setup network connection? (If you can not upload the results you will not see it)''')
if select_all_btn:
select_all_btn.touch()
self.logger.info("All selected!")
@@ -53,6 +57,12 @@ class ApkRunnerImpl(ApkTestRunner):
self.logger.info("Older version warning popped up")
warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
+ elif attention_msg:
+ self.report_result('glbenchmark25-run', 'fail')
+ self.logger.info("Network connection is required")
+ sys.exit(1)
else:
# continue
pass
diff --git a/automated/android/apk-automation/jbench.py b/automated/android/apk-automation/jbench.py
index 5ba24c5..33b8eb6 100755
--- a/automated/android/apk-automation/jbench.py
+++ b/automated/android/apk-automation/jbench.py
@@ -13,10 +13,24 @@ class ApkRunnerImpl(ApkTestRunner):
super(ApkRunnerImpl, self).__init__(self.config)
def execute(self):
- self.dump_always()
- btn_jbench = self.vc.findViewByIdOrRaise("it.JBench.bench:id/button1")
- btn_jbench.touch()
- time.sleep(2)
+ find_start_btn = False
+ while not find_start_btn:
+ time.sleep(2)
+ self.dump_always()
+ btn_jbench = self.vc.findViewById("it.JBench.bench:id/button1")
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
+ if warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
+ elif btn_jbench:
+ btn_jbench.touch()
+ find_start_btn = True
+ else:
+ self.logger.info("Nothing found, need to check manually")
finished = False
while (not finished):
diff --git a/automated/android/apk-automation/linpack.py b/automated/android/apk-automation/linpack.py
index 517e8c9..9fba9bf 100755
--- a/automated/android/apk-automation/linpack.py
+++ b/automated/android/apk-automation/linpack.py
@@ -17,10 +17,13 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(2)
self.dump_always()
warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if warn_msg:
self.logger.info("Older version warning popped up")
warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
else:
start_single_button = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btnsingle")
start_single_button.touch()
diff --git a/automated/android/apk-automation/main.py b/automated/android/apk-automation/main.py
index 1b06c80..5320fad 100755
--- a/automated/android/apk-automation/main.py
+++ b/automated/android/apk-automation/main.py
@@ -10,6 +10,8 @@ parser.add_argument('-n', '--name', dest='name', default='linpack',
help='Specify test name.')
parser.add_argument('-l', '--loops', type=int, dest='loops', default=1,
help='Set the number of test loops.')
+parser.add_argument('-g', '--governor', action='store_true', dest='set_governor_policy', default=False,
+ help='Specify if to set the governor policy to performance')
parser.add_argument('-v', '--verbose', action='store_true', dest='verbose',
default=False, help='Set the number of test loops.')
args = parser.parse_args()
diff --git a/automated/android/apk-automation/quadrantpro.py b/automated/android/apk-automation/quadrantpro.py
index 3360a2b..d6fd963 100755
--- a/automated/android/apk-automation/quadrantpro.py
+++ b/automated/android/apk-automation/quadrantpro.py
@@ -24,7 +24,15 @@ class ApkRunnerImpl(ApkTestRunner):
self.dump_always()
view_license_btn = self.vc.findViewWithText("View license")
run_full_item = self.vc.findViewWithText(u'Run full benchmark')
- if view_license_btn:
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
+ if warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
+ elif view_license_btn:
ok_button = self.vc.findViewWithTextOrRaise("OK")
ok_button.touch()
elif run_full_item:
diff --git a/automated/android/apk-automation/scimark.py b/automated/android/apk-automation/scimark.py
index bcc30d5..9fcc96f 100755
--- a/automated/android/apk-automation/scimark.py
+++ b/automated/android/apk-automation/scimark.py
@@ -12,10 +12,21 @@ class ApkRunnerImpl(ApkTestRunner):
super(ApkRunnerImpl, self).__init__(self.config)
def execute(self):
- time.sleep(5)
- self.dump_always()
- btn_java_bench = self.vc.findViewWithTextOrRaise(u'Java bench')
- btn_java_bench.touch()
+ find_start_btn = False
+ while not find_start_btn:
+ self.dump_always()
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
+ if warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
+ else:
+ btn_java_bench = self.vc.findViewWithTextOrRaise(u'Java bench')
+ btn_java_bench.touch()
+ find_start_btn = True
finished = False
while not finished:
diff --git a/automated/android/apk-automation/vellamo3.py b/automated/android/apk-automation/vellamo3.py
index 413ee61..3d763aa 100755
--- a/automated/android/apk-automation/vellamo3.py
+++ b/automated/android/apk-automation/vellamo3.py
@@ -48,9 +48,17 @@ class ApkRunnerImpl(ApkTestRunner):
btn_setup_1 = self.vc.findViewById("android:id/button1")
btn_settings = self.vc.findViewById('com.quicinc.vellamo:id/main_toolbar_wheel')
btn_animations = self.vc.findViewWithText(u'Make Vellamo even more beautiful')
+ warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
+ continue_btn = self.vc.findViewWithText(u'CONTINUE')
if btn_setup_1:
# Accept Vellamo EULA
btn_setup_1.touch()
+ elif warn_msg:
+ self.logger.info("Older version warning popped up")
+ warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
+ warning_ok_btn.touch()
+ elif continue_btn:
+ continue_btn.touch()
elif btn_settings:
# Open settings
btn_settings.touch()