--- tester/rt/test.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/tester/rt/test.py b/tester/rt/test.py index 3cd9b48..db83b77 100644 --- a/tester/rt/test.py +++ b/tester/rt/test.py @@ -285,8 +285,35 @@ def generate_json_report(args, reports, start_time, end_time, json.dump(json_log, outfile, sort_keys=True, indent=4) +def generate_junit_report(args, reports, start_time, end_time, + total, junit_file): + + from junit_xml import TestSuite, TestCase + import sys + junit_log = [] + + for name in reports.results: + result_type = reports.results[name]['result'] + test_parts = name.split("/") + test_category = test_parts[-2] + test_name = test_parts[-1] + + junit_result = TestCase(test_name.split('.')[0]) + junit_result.category = test_category + if result_type == "failed" or result_type == "timeout": + junit_result. add_failure_info(None, reports.results[name]["output"], result_type) + + junit_log.append(junit_result) + + ts = TestSuite("RTEMS Test Suite", junit_log) + + # write out junit log + with open(junit_file, 'w') as f: + TestSuite.to_file(f, [ts], prettyprint=True) + report_formatters = { - 'json': generate_json_report + 'json': generate_json_report, + 'junit': generate_junit_report } -- 2.17.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel