Refactoring of report exporter to support HTML and JUNIT. Added unicode encoding for strings coming from serial console

pull/561/merge
Przemek Wirkus 2014-10-15 13:38:20 +01:00
parent 091cccaf6e
commit 2274651892
2 changed files with 12 additions and 12 deletions

View File

@ -1274,16 +1274,6 @@ def singletest_in_cli_mode(single_test):
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext = single_test.execute()
elapsed_time = time() - start
if single_test.opts_report_html_file_name:
# Export results in form of HTML report to separate file
report_exporter = ReportExporter(ResultExporterType.HTML)
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_html_file_name, test_suite_properties=test_suite_properties_ext)
if single_test.opts_report_junit_file_name:
# Export results in form of HTML report to separate file
report_exporter = ReportExporter(ResultExporterType.JUNIT)
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext)
# Human readable summary
if not single_test.opts_suppress_summary:
# prints well-formed summary with results (SQL table like)
@ -1294,6 +1284,16 @@ def singletest_in_cli_mode(single_test):
print single_test.generate_test_summary_by_target(test_summary, shuffle_seed)
print "Completed in %.2f sec"% (elapsed_time)
# Store extra reports in files
if single_test.opts_report_html_file_name:
# Export results in form of HTML report to separate file
report_exporter = ReportExporter(ResultExporterType.HTML)
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_html_file_name, test_suite_properties=test_suite_properties_ext)
if single_test.opts_report_junit_file_name:
# Export results in form of HTML report to separate file
report_exporter = ReportExporter(ResultExporterType.JUNIT)
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext)
def mps2_set_board_image_file(disk, images_cfg_path, image0file_path, image_name='images.txt'):
""" This function will alter image cfg file.

View File

@ -121,7 +121,7 @@ class ReportExporter():
tooltip_name,
test['test_description'],
test['elapsed_time'],
test['single_test_output'].encode('ascii', 'ignore').replace('\n', '<br />'))
unicode(test['single_test_output'], errors='ignore').replace('\n', '<br />'))
return result
def get_result_tree(self, test_results):
@ -216,7 +216,7 @@ class ReportExporter():
name = test_result['test_description']
classname = 'test.%s.%s.%s'% (target, toolchain, test_result['test_id'])
elapsed_sec = test_result['elapsed_time']
_stdout = test_result['single_test_output'].encode('ascii', 'ignore')
_stdout = unicode(test_result['single_test_output'], errors='ignore')
_stderr = ''
tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr)