mirror of
https://github.com/mesonbuild/meson.git
synced 2026-06-24 08:48:03 +00:00
meson-test-run.xml: Always attach output to testcase node
This means that we capture that information even for SKIP and UNEXRUN cases. v2: Match the schema's ordering of testcase node's children. The schema uses 'sequence' for testcase, so child nodes should appear in a specific order. Restructure _run_tests a bit, so it's easy to do that.
This commit is contained in:
committed by
Paolo Bonzini
parent
542232a598
commit
d26bbb64b8
@@ -1295,14 +1295,15 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
|
||||
testcase_time = result.conftime + result.buildtime + result.testtime
|
||||
current_test.set('time', '%.3f' % testcase_time)
|
||||
|
||||
# skip
|
||||
if is_skipped and skip_as_expected:
|
||||
f.update_log(TestStatus.SKIP)
|
||||
if not t.skip_category:
|
||||
safe_print(bold('Reason:'), skip_reason)
|
||||
ET.SubElement(current_test, 'skipped', {})
|
||||
continue
|
||||
|
||||
if not skip_as_expected:
|
||||
# unexrun/unexskip
|
||||
elif not skip_as_expected:
|
||||
failing_tests += 1
|
||||
if is_skipped:
|
||||
skip_msg = f'Test asked to be skipped ({skip_reason}), but was not expected to'
|
||||
@@ -1315,10 +1316,9 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
|
||||
f.update_log(status)
|
||||
safe_print(bold('Reason:'), result.msg)
|
||||
ET.SubElement(current_test, 'failure', {'message': result.msg})
|
||||
continue
|
||||
|
||||
# Handle Failed tests
|
||||
if result.msg != '':
|
||||
# failed
|
||||
elif result.msg != '':
|
||||
f.update_log(TestStatus.ERROR)
|
||||
safe_print(bold('During:'), result.step.name)
|
||||
safe_print(bold('Reason:'), result.msg)
|
||||
@@ -1356,6 +1356,10 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
|
||||
safe_print("Cancelling the rest of the tests")
|
||||
for f2 in futures:
|
||||
f2.cancel()
|
||||
|
||||
ET.SubElement(current_test, 'failure', {'message': result.msg})
|
||||
|
||||
# success
|
||||
else:
|
||||
f.update_log(TestStatus.OK)
|
||||
passing_tests += 1
|
||||
@@ -1367,16 +1371,18 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
|
||||
else:
|
||||
mesonlib.windows_proof_rmtree(abspath)
|
||||
|
||||
conf_time += result.conftime
|
||||
build_time += result.buildtime
|
||||
test_time += result.testtime
|
||||
log_text_file(logfile, t.path, result)
|
||||
if result.msg != '':
|
||||
ET.SubElement(current_test, 'failure', {'message': result.msg})
|
||||
stdoel = ET.SubElement(current_test, 'system-out')
|
||||
stdoel.text = mtest.replace_unencodable_xml_chars(result.stdo)
|
||||
stdeel = ET.SubElement(current_test, 'system-err')
|
||||
stdeel.text = mtest.replace_unencodable_xml_chars(result.stde)
|
||||
if result:
|
||||
# track total runtime
|
||||
conf_time += result.conftime
|
||||
build_time += result.buildtime
|
||||
test_time += result.testtime
|
||||
|
||||
# attach stdout and stderr child nodes to 'testcase' node
|
||||
ET.SubElement(current_test, 'system-out').text = mtest.replace_unencodable_xml_chars(result.stdo)
|
||||
ET.SubElement(current_test, 'system-err').text = mtest.replace_unencodable_xml_chars(result.stde)
|
||||
|
||||
# write stdout/stderr to log file (and terminal)
|
||||
log_text_file(logfile, t.path, result)
|
||||
|
||||
# Reset, just in case
|
||||
safe_print = default_print
|
||||
|
||||
Reference in New Issue
Block a user