summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-11-13 10:44:34 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-11-13 11:38:22 +0000
commit367a6df7cee4d79ad60c71699dd2d843bce9f7ab (patch)
tree5de2e61e32db0508a831559ab4b21f14b3d87798
parentab9ae1f7f4e2ecdaed5897fbf776afa70eeb0db4 (diff)
android: tradefed: dump logs when adb connection lost
When adb connection lost, send 'd l' command to TF shell to dump the logs of all invocations to files, and then upload them to Artifactorial for debugging. Change-Id: Iaf3d5a4509370b449390b2b590f870d8a1150909 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/android/tradefed/tradefed-runner.py3
-rw-r--r--automated/android/tradefed/tradefed.yaml2
2 files changed, 5 insertions, 0 deletions
diff --git a/automated/android/tradefed/tradefed-runner.py b/automated/android/tradefed/tradefed-runner.py
index b0c5d77..ebf9b26 100755
--- a/automated/android/tradefed/tradefed-runner.py
+++ b/automated/android/tradefed/tradefed-runner.py
@@ -164,6 +164,9 @@ while child.isalive():
adb_command = "adb shell echo OK"
adb_check = subprocess.Popen(shlex.split(adb_command))
if adb_check.wait() != 0:
+ logger.debug('adb connection lost! Trying to dump logs of all invocations...')
+ child.sendline('d l')
+ time.sleep(30)
subprocess.call(['sh', '-c', '. ../../lib/sh-test-lib && . ../../lib/android-test-lib && adb_debug_info'])
logger.debug('"adb devices" output')
subprocess.call(['adb', 'devices'])
diff --git a/automated/android/tradefed/tradefed.yaml b/automated/android/tradefed/tradefed.yaml
index 5d6515e..d9db822 100644
--- a/automated/android/tradefed/tradefed.yaml
+++ b/automated/android/tradefed/tradefed.yaml
@@ -44,6 +44,8 @@ run:
# Upload test log and result files to artifactorial.
- cp -r ./${TEST_PATH}/results ./output/ || true
- cp -r ./${TEST_PATH}/logs ./output/ || true
+ # Include logs dumped from TF shell 'd l' command.
+ - if ls /tmp/tradefed*; then cp -r /tmp/tradefed* ./output || true; fi
- tar caf tradefed-output-$(date +%Y%m%d%H%M%S).tar.xz ./output
- ATTACHMENT=$(ls tradefed-output-*.tar.xz)
- ../../utils/upload-to-artifactorial.sh -a "${ATTACHMENT}" -u "${URL}" -t "${TOKEN}"