From c4b62b2d84d5f411dfef8336c320b1e82c532a54 Mon Sep 17 00:00:00 2001 From: Anders Roxell Date: Fri, 11 Aug 2023 10:53:21 +0200 Subject: [PATCH] android: noninteractive-tradefed: readd install_deps Readd install_deps so the test can install the correct dependencies without having to find them. Add a python version check that errors out if the python version isn't >=3.8. Fixes: 2caa92bc01d8 ("noninteractive-tradefed: change to work with python3") Signed-off-by: Anders Roxell --- automated/android/noninteractive-tradefed/setup.sh | 12 ++++++++++++ .../android/noninteractive-tradefed/tradefed.yaml | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/automated/android/noninteractive-tradefed/setup.sh b/automated/android/noninteractive-tradefed/setup.sh index de5bbd3d3..57a1b2c90 100755 --- a/automated/android/noninteractive-tradefed/setup.sh +++ b/automated/android/noninteractive-tradefed/setup.sh @@ -5,15 +5,23 @@ . ../../lib/sh-test-lib . ../../lib/android-test-lib +SKIP_INSTALL=${1:-"false"} +JDK="openjdk-11-jdk-headless" java_path="/usr/lib/jvm/java-11-openjdk-amd64/bin/java" if [ -n "${ANDROID_VERSION}" ] && echo "${ANDROID_VERSION}" | grep -q "aosp-android14"; then # use openjdk-17 for Android14+ versions + JDK="openjdk-17-jdk-headless" java_path="/usr/lib/jvm/java-17-openjdk-amd64/bin/java" fi +PKG_DEPS="aapt apt-utils coreutils curl git lib32gcc1 lib32z1-dev libc6-dev-i386 libcurl protobuf-compiler psmisc python3 python-is-python3 python-lxml python-pexpect python-protobuf python-setuptools sudo tar unzip usbutils wget xz-utils zip " + dist_name case "${dist}" in ubuntu) + dpkg --add-architecture i386 + apt-get update -q + install_deps "${PKG_DEPS} ${JDK}" "${SKIP_INSTALL}" # make sure to use the right java version update-alternatives --set java ${java_path} ;; @@ -22,6 +30,10 @@ case "${dist}" in ;; esac +# Only aosp-master need the python version check. +if [ -n "${ANDROID_VERSION}" ] && echo "${ANDROID_VERSION}" | grep -q "aosp-master"; then + chech_python_version "$(python --verison)" "3.8" "Error" +fi install_latest_adb initialize_adb adb_root diff --git a/automated/android/noninteractive-tradefed/tradefed.yaml b/automated/android/noninteractive-tradefed/tradefed.yaml index a03900976..b2c95f101 100644 --- a/automated/android/noninteractive-tradefed/tradefed.yaml +++ b/automated/android/noninteractive-tradefed/tradefed.yaml @@ -14,6 +14,7 @@ metadata: - functional params: + SKIP_INSTALL: "false" # Specify timeout in seconds for wait_boot_completed and wait_homescreen. TIMEOUT: "300" # Download CTS package or copy it from local disk. @@ -46,7 +47,7 @@ run: steps: - cd ./automated/android/noninteractive-tradefed # Run setup.sh in the original shell to reserve env variables. - - . ./setup.sh + - . ./setup.sh "${SKIP_INSTALL}" - echo "after ./setup.sh" # delete the test user to clean environment - userdel testuser -r -f || true