Skip to content

Commit 2caa92b

Browse files
committed
noninteractive-tradefed: change to work with python3
This commit change to use python3 for tradefed-runner.py, and drop the packages installation as they will be installed on the Linaro Ubuntu20.04 based docker image side which will have python3 installed as the default python: https://hub.docker.com/r/linaro/lava-android-postprocess Or the user needs to prepare the packages on the host first. The background is that, the latest AOSP vts package needs to have python3.8+ to run the vts_kernel_proc_file_api_test module after the following commit: https://android.googlesource.com/platform/test/vts-testcase/vndk/+/6f09ccb69d553a48dd231635a06889af26ff545f%5E%21/#F3 Otherwise, the following error will be reported: 07-26 12:45:26 I/ModuleListener: [66/67] cbe37e vts_kernel_proc_file_api_test __main__.VtsKernelProcFileApiTest#test_ProcZoneInfoTest FAILURE: Traceback (most recent call last): File "/tmp/Soong.python_p2c4wyvb/vts_kernel_proc_file_api_test.py", line 277, in test test_object.set_api_level(self.dut) File "/tmp/Soong.python_p2c4wyvb/proc_tests/KernelProcFileTestBase.py", line 140, in set_api_level self.api_level = dut.getLaunchApiLevel(strict=False) File "/tmp/Soong.python_p2c4wyvb/vts/testcases/vndk/utils.py", line 147, in getLaunchApiLevel return self.GetLaunchApiLevel() File "/tmp/Soong.python_p2c4wyvb/vts/testcases/vndk/utils.py", line 122, in GetLaunchApiLevel level_str = self._GetProp("ro.product.first_api_level") File "/tmp/Soong.python_p2c4wyvb/vts/testcases/vndk/utils.py", line 94, in _GetProp out, err, return_code = self.Execute("getprop", name) File "/tmp/Soong.python_p2c4wyvb/vts/testcases/vndk/utils.py", line 68, in Execute cmd = ["adb", "-s", self._serial_number, "shell", shlex.join(args)] AttributeError: module 'shlex' has no attribute 'join' Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
1 parent 7220645 commit 2caa92b

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

automated/android/noninteractive-tradefed/setup.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,15 @@
55
. ../../lib/sh-test-lib
66
. ../../lib/android-test-lib
77

8-
JDK="openjdk-11-jdk-headless"
98
java_path="/usr/lib/jvm/java-11-openjdk-amd64/bin/java"
109
if [ -n "${ANDROID_VERSION}" ] && echo "${ANDROID_VERSION}" | grep -q "aosp-android14"; then
1110
# use openjdk-17 for Android14+ versions
12-
JDK="openjdk-17-jdk-headless"
1311
java_path="/usr/lib/jvm/java-17-openjdk-amd64/bin/java"
1412
fi
1513

16-
PKG_DEPS="coreutils usbutils curl wget zip xz-utils python-lxml python-setuptools python-pexpect aapt lib32z1-dev libc6-dev-i386 lib32gcc1 libc6:i386 libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 python-dev python-protobuf protobuf-compiler python-virtualenv python-pip python-pexpect psmisc"
17-
1814
dist_name
1915
case "${dist}" in
2016
ubuntu)
21-
dpkg --add-architecture i386
22-
apt-get update -q
23-
install_deps "${PKG_DEPS} ${JDK}"
2417
# make sure to use the right java version
2518
update-alternatives --set java ${java_path}
2619
;;

automated/android/noninteractive-tradefed/tradefed-runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import datetime
44
import os
@@ -27,7 +27,7 @@
2727

2828
def result_parser(xml_file, result_format):
2929
etree_file = open(xml_file, "rb")
30-
etree_content = etree_file.read()
30+
etree_content = etree_file.read().decode("utf-8")
3131
rx = re.compile("&#([0-9]+);|&#x([0-9a-fA-F]+);")
3232
endpos = len(etree_content)
3333
pos = 0

automated/android/noninteractive-tradefed/tradefed.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ metadata:
1414
- functional
1515

1616
params:
17-
SKIP_INSTALL: "false"
1817
# Specify timeout in seconds for wait_boot_completed and wait_homescreen.
1918
TIMEOUT: "300"
2019
# Download CTS package or copy it from local disk.

0 commit comments

Comments
 (0)