diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2018-01-17 15:54:29 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2018-01-17 15:54:29 +0800 |
commit | 726c1c7a0c61dea9b58a86afa5d89b7785b0d07a (patch) | |
tree | e6b7a08cb3d587b28a87130409f8fe2dd1cad594 | |
parent | 51ec25196c21401339339f1d2001b8dac7f1a474 (diff) | |
parent | 7f980ef5a3a143dcd63db6a505ee6a4787e8f780 (diff) |
Merge branch 'master' of ssh://git.linaro.org/people/yongqin.liu/public/test-definitions into self-master
-rwxr-xr-x | automated/android/tradefed/tradefed-runner.py | 37 | ||||
-rwxr-xr-x | automated/android/tradefed/tradefed.sh | 9 | ||||
-rw-r--r-- | automated/android/tradefed/tradefed.yaml | 9 |
3 files changed, 52 insertions, 3 deletions
diff --git a/automated/android/tradefed/tradefed-runner.py b/automated/android/tradefed/tradefed-runner.py index b0c5d77..81541a1 100755 --- a/automated/android/tradefed/tradefed-runner.py +++ b/automated/android/tradefed/tradefed-runner.py @@ -85,6 +85,28 @@ def result_parser(xml_file, result_format): str(tests_failed)) py_test_lib.add_result(RESULT_FILE, result) + # output result to show if the module is done or not + tests_done = elem.get('done', 'false') + if tests_done == 'false': + result = '%s_done fail' % module_name + else: + result = '%s_done pass' % module_name + py_test_lib.add_result(RESULT_FILE, result) + + # print failed test cases for debug + test_cases = elem.findall('.//TestCase') + for test_case in test_cases: + failed_tests = test_case.findall('.//Test[@result="fail"]') + for failed_test in failed_tests: + test_name = '%s/%s.%s' % (module_name, test_case.get("name"), failed_test.get("name")) + failures = failed_test.findall('.//Failure') + failure_msg = '' + for failure in failures: + failure_msg = '%s \n %s' % (failure_msg, failure.get('message')) + + logger.info('%s %s' % (test_name, failure_msg.strip())) + + if result_format == ATOMIC: test_cases = elem.findall('.//TestCase') for test_case in test_cases: @@ -142,6 +164,7 @@ if args.TEST_PATH == "android-cts": command = "android-cts/tools/cts-tradefed" prompt = "cts-tf >" if args.TEST_PATH == "android-vts": + os.environ["VTS_ROOT"] = os.getcwd() command = "android-vts/tools/vts-tradefed" prompt = "vts-tf >" @@ -149,6 +172,14 @@ if command is None: logger.error("Not supported path: %s" % args.TEST_PATH) sys.exit(1) +vts_monitor_enabled = False +if command == 'android-vts/tools/vts-tradefed' and \ + os.path.exists('android-vts/testcases/vts/script/monitor-runner-output.py'): + vts_monitor_enabled = True + vts_run_details = open('{}/vts_run_details.txt'.format(OUTPUT), 'w') + monitor_cmd = 'android-vts/testcases/vts/script/monitor-runner-output.py -m' + monitor_vts_output = subprocess.Popen(shlex.split(monitor_cmd), stderr=subprocess.STDOUT, stdout=vts_run_details) + child = pexpect.spawn(command, logfile=tradefed_stdout) try: child.expect(prompt, timeout=60) @@ -164,6 +195,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']) @@ -213,6 +247,9 @@ logger.info('Tradefed test finished') tradefed_logcat.kill() tradefed_logcat_out.close() tradefed_stdout.close() +if vts_monitor_enabled: + monitor_vts_output.kill() + vts_run_details.close() # Locate and parse test result. result_dir = '%s/results' % args.TEST_PATH diff --git a/automated/android/tradefed/tradefed.sh b/automated/android/tradefed/tradefed.sh index 31f64e7..f020542 100755 --- a/automated/android/tradefed/tradefed.sh +++ b/automated/android/tradefed/tradefed.sh @@ -54,14 +54,23 @@ java -version # Download CTS/VTS test package or copy it from local disk. if echo "${TEST_URL}" | grep "^http" ; then + df -h + ls -l ./ + ls -l ../ wget -S --progress=dot:giga "${TEST_URL}" else cp "${TEST_URL}" ./ fi +echo "before run basename" file_name=$(basename "${TEST_URL}") + +echo "before run unzip" +pwd +ls -l ./* unzip -q "${file_name}" rm -f "${file_name}" +echo "after run unzip" if [ -d "${TEST_PATH}/results" ]; then mv "${TEST_PATH}/results" "${TEST_PATH}/results_$(date +%Y%m%d%H%M%S)" fi diff --git a/automated/android/tradefed/tradefed.yaml b/automated/android/tradefed/tradefed.yaml index 235078c..baf2a5e 100644 --- a/automated/android/tradefed/tradefed.yaml +++ b/automated/android/tradefed/tradefed.yaml @@ -37,16 +37,19 @@ run: - . ./setup.sh - echo "after ./setup.sh" # delete the test user to clean environment - - sudo userdel testuser -r -f || true + - userdel testuser -r -f || true # create test use to run the cts/vts tests - - sudo useradd -m testuser && echo "testuser created successfully" + - useradd -m testuser && echo "testuser created successfully" + - chown testuser:testuser . - 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 + # 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}" # Send test result to LAVA. - ../../utils/send-to-lava.sh ./output/result.txt - - sudo userdel testuser -f -r || true + - userdel testuser -f -r || true |