summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2017-12-21 21:03:26 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2017-12-21 21:03:26 +0800
commit9bf5f1382133469f4e2132df528bf0bc43fcc030 (patch)
treef5398a2e85668262ac81e7d5aa4130ffbdce615a
parent484ef3fa8769804a52fbd06a786d331ca9eae74a (diff)
output failed cts test cases for debug information
Change-Id: I91f4748caa2c8a4988524e74dad02680245a3eca Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xautomated/android/tradefed/tradefed-runner.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/automated/android/tradefed/tradefed-runner.py b/automated/android/tradefed/tradefed-runner.py
index ebf9b26..3c3181c 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))
+
+
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)
@@ -216,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