@@ -124,10 +124,12 @@ def __init__(self, args):
124124 self .failed_count = 0
125125
126126 if args .output_dir :
127+ self .output_dir = args .output_dir
127128 self .xml_data_dir = os .path .join (args .output_dir , 'xml_data' )
128129 if not os .path .exists (self .xml_data_dir ):
129130 os .makedirs (self .xml_data_dir )
130131 else :
132+ self .output_dir = ""
131133 self .xml_data_dir = "xml_data"
132134
133135 if args .build and not args .build_execute :
@@ -230,7 +232,8 @@ def generateIndexHtml(self):
230232 prj_dir = os .getcwd ().replace ("\\ " ,"/" ) + "/"
231233
232234 tempHtmlReportList = glob .glob ("*.html" )
233- tempHtmlReportList += glob .glob (os .path .join (args .html_base_dir , "*.html" ))
235+ tempHtmlReportList += glob .glob (os .path .join (self .xml_data_dir , "*.html" ))
236+ tempHtmlReportList += glob .glob (os .path .join (self .html_base_dir , "*.html" ))
234237 htmlReportList = []
235238
236239 for report in tempHtmlReportList :
@@ -240,7 +243,7 @@ def generateIndexHtml(self):
240243 htmlReportList .append (report )
241244
242245 from create_index_html import create_index_html
243- create_index_html (self .FullMP , self .ciTool == CITool .GITLAB )
246+ create_index_html (self .FullMP , self .ciTool == CITool .GITLAB , output_dir = self . output_dir )
244247
245248 def runJunitMetrics (self ):
246249 print ("Creating JUnit Metrics" )
@@ -329,23 +332,32 @@ def runPcLintPlusMetrics(self):
329332
330333 def runReports (self ):
331334 if self .aggregate :
335+ agg_rpt_name = os .path .join (self .output_dir , self .mpName + "_aggregate_report.html" )
332336 print ("Creating Aggregate Coverage Report" )
333- self .manageWait .exec_manage_command ("--create-report=aggregate --output=" + self .mpName + "_aggregate_report.html" )
337+ if os .path .exists (agg_rpt_name ):
338+ os .remove (agg_rpt_name )
339+ self .manageWait .exec_manage_command ("--create-report=aggregate --output=" + agg_rpt_name )
334340 self .needIndexHtml = True
335341 if self .metrics :
342+ met_rpt_name = os .path .join (self .output_dir , self .mpName + "_metrics_report.html" )
336343 print ("Creating Metrics Report" )
337- self .manageWait .exec_manage_command ("--create-report=metrics --output=" + self .mpName + "_metrics_report.html" )
344+ if os .path .exists (met_rpt_name ):
345+ os .remove (met_rpt_name )
346+ self .manageWait .exec_manage_command ("--create-report=metrics --output=" + met_rpt_name )
338347 self .needIndexHtml = True
339348 if self .fullstatus :
349+ fs_rpt_name = os .path .join (self .output_dir , self .mpName + "_full_status_report.html" )
350+ if os .path .exists (fs_rpt_name ):
351+ os .remove (fs_rpt_name )
340352 print ("Creating Full Status Report" )
341- self .manageWait .exec_manage_command ("--full-status=" + self . mpName + "_full_status_report.html" )
353+ self .manageWait .exec_manage_command ("--full-status=" + fs_rpt_name )
342354 self .needIndexHtml = True
343355
344356 def generateTestCaseMgtRpt (self ):
345- if not os .path .exists ("management" ):
346- os .makedirs ("management" )
357+ if not os .path .exists (os . path . join ( self . output_dir , "management" ) ):
358+ os .makedirs (os . path . join ( self . output_dir , "management" ) )
347359 else :
348- for file in glob .glob ("management/ *_management_report.html" ):
360+ for file in glob .glob (os . path . join ( self . output_dir , "management" , " *_management_report.html") ):
349361 os .remove (file )
350362
351363 if checkVectorCASTVersion (21 ):
@@ -360,7 +372,7 @@ def generateTestCaseMgtRpt(self):
360372 self .needIndexHtml = True
361373
362374 report_name = env .compiler .name + "_" + env .testsuite .name + "_" + env .name + "_management_report.html"
363- report_name = os .path .join ("management" ,report_name )
375+ report_name = os .path .join (self . output_dir , "management" ,report_name )
364376 print (f"Creating Test Case Management HTML report for { env .name } in { report_name } " )
365377 env .api .report (report_type = "MANAGEMENT_REPORT" , formats = ["HTML" ], output_file = report_name )
366378 else :
0 commit comments