2020from tools .utils import construct_enum , mkdir
2121import os
2222
23-
2423ResultExporterType = construct_enum (HTML = 'Html_Exporter' ,
2524 JUNIT = 'JUnit_Exporter' ,
2625 JUNIT_OPER = 'JUnit_Exporter_Interoperability' ,
@@ -73,7 +72,8 @@ def __init__(self, result_exporter_type, package="test"):
7372 self .result_exporter_type = result_exporter_type
7473 self .package = package
7574
76- def report (self , test_summary_ext , test_suite_properties = None ):
75+ def report (self , test_summary_ext , test_suite_properties = None ,
76+ print_log_for_failures = True ):
7777 """ Invokes report depending on exporter_type set in constructor
7878 """
7979 if self .result_exporter_type == ResultExporterType .HTML :
@@ -87,7 +87,7 @@ def report(self, test_summary_ext, test_suite_properties=None):
8787 return self .exporter_junit_ioper (test_summary_ext , test_suite_properties )
8888 elif self .result_exporter_type == ResultExporterType .PRINT :
8989 # JUNIT exporter for interoperability test
90- return self .exporter_print (test_summary_ext )
90+ return self .exporter_print (test_summary_ext , print_log_for_failures = print_log_for_failures )
9191 return None
9292
9393 def report_to_file (self , test_summary_ext , file_name , test_suite_properties = None ):
@@ -297,11 +297,15 @@ def exporter_junit(self, test_result_ext, test_suite_properties=None):
297297 test_suites .append (ts )
298298 return TestSuite .to_xml_string (test_suites )
299299
300- def exporter_print_helper (self , array ):
300+ def exporter_print_helper (self , array , print_log = False ):
301301 for item in array :
302302 print " * %s::%s::%s" % (item ["target_name" ], item ["toolchain_name" ], item ["id" ])
303+ if print_log :
304+ log_lines = item ["output" ].split ("\n " )
305+ for log_line in log_lines :
306+ print " %s" % log_line
303307
304- def exporter_print (self , test_result_ext ):
308+ def exporter_print (self , test_result_ext , print_log_for_failures = False ):
305309 """ Export test results in print format.
306310 """
307311 failures = []
@@ -340,7 +344,7 @@ def exporter_print(self, test_result_ext):
340344
341345 if failures :
342346 print "\n \n Build failures:"
343- self .exporter_print_helper (failures )
347+ self .exporter_print_helper (failures , print_log = print_log_for_failures )
344348 return False
345349 else :
346350 return True
0 commit comments