diff options
author | Chase Qi <chase.qi@linaro.org> | 2017-09-22 11:58:20 +0800 |
---|---|---|
committer | Chase Qi <chase.qi@linaro.org> | 2017-09-22 11:58:20 +0800 |
commit | 1c148fb0d0b462a041aad55aee30b9a212bf0c1a (patch) | |
tree | 0e7f95c7dd58793b520b5afd3d542fc37a6facda | |
parent | ea54335d54fa362659eff545857c1d0aae9d5045 (diff) |
android: tradefed: pass ANDROID_SERIAL env var to tradefed-runner
Environment variable ANDROID_SERIAL is set in setup.sh with
initialize_adb() function as root user; while test is executed from
tradefed.sh as testuser, we need to pass the variable to it.
tradfed-runner.py is started from tradefed.sh, subprocess picks all
environment vars set in tradefed.sh by default. Once ANDROID_SERIAL set
properly, test will continue even when other devices appear during the
test. So, this patch also can be a workaround for the below LAVA issue.
https://projects.linaro.org/browse/CTT-481
Change-Id: Ic1479c2e835e08df0db22152cef6bf19ed12bfda
Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-x | automated/android/tradefed/tradefed.sh | 3 | ||||
-rw-r--r-- | automated/android/tradefed/tradefed.yaml | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/automated/android/tradefed/tradefed.sh b/automated/android/tradefed/tradefed.sh index 08bc20a..31f64e7 100755 --- a/automated/android/tradefed/tradefed.sh +++ b/automated/android/tradefed/tradefed.sh @@ -22,7 +22,7 @@ usage() { while getopts ':o:n:c:t:p:r:' opt; do case "${opt}" in o) TIMEOUT="${OPTARG}" ;; - n) ANDROID_SERIAL="${OPTARG}" ;; + n) export ANDROID_SERIAL="${OPTARG}" ;; c) TEST_URL="${OPTARG}" ;; t) TEST_PARAMS="${OPTARG}" ;; p) TEST_PATH="${OPTARG}" ;; @@ -34,6 +34,7 @@ done if [ -e "/home/testuser" ]; then export HOME=/home/testuser fi + disable_suspend wait_boot_completed "${TIMEOUT}" # wait_homescreen() searches logcat output for diff --git a/automated/android/tradefed/tradefed.yaml b/automated/android/tradefed/tradefed.yaml index 7ed36b1..4d3d467 100644 --- a/automated/android/tradefed/tradefed.yaml +++ b/automated/android/tradefed/tradefed.yaml @@ -33,10 +33,11 @@ params: run: steps: - cd ./automated/android/tradefed - - ./setup.sh + # Run setup.sh in the original shell to reserve env variables. + - . ./setup.sh - id -u testuser &>/dev/null || useradd testuser - mkdir -p /home/testuser; chown testuser.testuser /home/testuser - - sudo -u testuser ./tradefed.sh -o "${TIMEOUT}" -c "${TEST_URL}" -t "${TEST_PARAMS}" -p "${TEST_PATH}" -r "${RESULTS_FORMAT}" + - sudo -u testuser ./tradefed.sh -o "${TIMEOUT}" -c "${TEST_URL}" -t "${TEST_PARAMS}" -p "${TEST_PATH}" -r "${RESULTS_FORMAT}" -n "${ANDROID_SERIAL}" # Upload test log and result files to artifactorial. - cp -r ./${TEST_PATH}/results ./output/ || true - cp -r ./${TEST_PATH}/logs ./output/ || true |