@@ -635,13 +635,6 @@ def __init__(self, FullManageProjectName, verbose = False,
635635 use_cte = False ):
636636
637637 super (GenerateManageXml , self ).__init__ (FullManageProjectName , verbose , teePrint , use_cte )
638- print ("GenerateManageXml::__init__ : api = VCProjectApi(self.FullManageProjectName)" )
639- self .api = VCProjectApi (FullManageProjectName )
640-
641- try :
642- self .has_sfp_enabled = self .api .environment .get_option ("VCAST_COVERAGE_SOURCE_FILE_PERSPECTIVE" )
643- except :
644- self .has_sfp_enabled = False
645638
646639 self .FullManageProjectName = FullManageProjectName
647640 self .generate_exec_rpt_each_testcase = generate_exec_rpt_each_testcase
@@ -658,6 +651,36 @@ def __init__(self, FullManageProjectName, verbose = False,
658651 self .useStartLine = useStartLine
659652
660653 self .cleanupXmlDataDir ()
654+
655+ tmpApi = VCProjectApi (FullManageProjectName )
656+
657+ try :
658+ self .has_sfp_enabled = tmpApi .environment .get_option ("VCAST_COVERAGE_SOURCE_FILE_PERSPECTIVE" )
659+ except :
660+ self .has_sfp_enabled = False
661+
662+ self .system_tests_status_report_generated = False
663+
664+ hasCover = any (isinstance (env .api , CoverApi ) for env in tmpApi .Environment .all ())
665+ tmpApi .close ()
666+
667+ if hasCover :
668+ report_name = os .path .basename (self .FullManageProjectName )[:- 4 ] + "_system_tests_status.html"
669+
670+ print (" Creating System Test Status " + self .FullManageProjectName )
671+ callStr = os .environ .get ('VECTORCAST_DIR' ) + os .sep + "manage -p " + self .FullManageProjectName + " --system-tests-status=" + report_name
672+ print (" *** running manage command: {}" .format (callStr ))
673+ import subprocess
674+ p = subprocess .Popen (callStr , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True )
675+ out , err = p .communicate ()
676+
677+ if err :
678+ print ("Cannot create system test status report{} {}" .format (out , err ))
679+
680+ self .system_tests_status_report_generated = True
681+
682+ print ("GenerateManageXml::__init__ : api = VCProjectApi(self.FullManageProjectName)" )
683+ self .api = VCProjectApi (FullManageProjectName )
661684
662685 def cleanupXmlDataDir (self ):
663686 path = "xml_data"
@@ -790,7 +813,8 @@ def generate_local_results(self, results, key):
790813 self .print_exc ,
791814 self .useStartLine ,
792815 self .teePrint ,
793- self .use_cte )
816+ self .use_cte ,
817+ self .system_tests_status_report_generated )
794818
795819 localXML .topLevelAPI = self .api
796820 localXML .noResults = self .noResults
@@ -991,7 +1015,7 @@ def generate_testresults(self):
9911015class GenerateXml (BaseGenerateXml ):
9921016
9931017 def __init__ (self , FullManageProjectName , build_dir , env , compiler , testsuite , cover_report_name , jenkins_name , unit_report_name , jenkins_link , jobNameDotted , verbose = False , cbtDict = None , generate_exec_rpt_each_testcase = True ,
994- use_archive_extract = False , report_failed_only = False , print_exc = False , useStartLine = False , teePrint = None , use_cte = False ):
1018+ use_archive_extract = False , report_failed_only = False , print_exc = False , useStartLine = False , teePrint = None , use_cte = False , system_tests_status_report_generated = False ):
9951019
9961020 super (GenerateXml , self ).__init__ (FullManageProjectName , verbose , teePrint , use_cte )
9971021
@@ -1004,28 +1028,6 @@ def __init__(self, FullManageProjectName, build_dir, env, compiler, testsuite, c
10041028 self .topLevelAPI = None
10051029 self .noResults = False
10061030 self .useStartLine = useStartLine
1007-
1008-
1009- if compiler and testsuite and env :
1010- level = compiler + "/" + testsuite + "/" + env
1011- else :
1012- level = ""
1013-
1014- report_name = os .path .basename (self .FullManageProjectName )[:- 4 ] + "_system_tests_status.html"
1015-
1016- print (" Creating System Test Status " + self .FullManageProjectName )
1017- callStr = os .environ .get ('VECTORCAST_DIR' ) + os .sep + "manage -p " + self .FullManageProjectName + " --system-tests-status=" + report_name
1018- if level :
1019- callStr += " --level " + level
1020- if envName :
1021- callStr += " -e " + envName
1022-
1023- print (" *** running manage command: {}" .format (callStr ))
1024- p = subprocess .Popen (callStr , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True )
1025- out , err = p .communicate ()
1026-
1027- if err :
1028- print ("Cannot create system test status report{} {}" .format (out , err ))
10291031
10301032 ## use hash code instead of final directory name as regression scripts can have overlapping final directory names
10311033 build_dir = build_dir .replace ("\\ " ,"/" )
@@ -1055,6 +1057,31 @@ def __init__(self, FullManageProjectName, build_dir, env, compiler, testsuite, c
10551057 cov_path = os .path .join (build_dir ,env + '.vcp' )
10561058 unit_path = os .path .join (build_dir ,env + '.vce' )
10571059 if os .path .exists (cov_path ):
1060+ if not system_tests_status_report_generated :
1061+ if compiler and testsuite and env :
1062+ level = compiler + "/" + testsuite + "/" + env
1063+ report_name = "{}_{}_system_tests_status.html" .format (os .path .basename (self .FullManageProjectName )[:- 4 ], level )
1064+ else :
1065+ level = ""
1066+ report_name = os .path .basename (self .FullManageProjectName )[:- 4 ] + "_system_tests_status.html"
1067+
1068+
1069+ print (" Creating System Test Status " + self .FullManageProjectName )
1070+ callStr = os .environ .get ('VECTORCAST_DIR' ) + os .sep + "manage -p " + self .FullManageProjectName + " --system-tests-status=" + report_name
1071+
1072+ if level :
1073+ callStr += " --level " + level
1074+ if env :
1075+ callStr += " -e " + env
1076+
1077+ print (" *** running manage command: {}{}" .format (GenerateXml , callStr ))
1078+ import subprocess
1079+ p = subprocess .Popen (callStr , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True )
1080+ out , err = p .communicate ()
1081+
1082+ if err :
1083+ print ("Cannot create system test status report{} {}" .format (out , err ))
1084+
10581085 self .api = CoverApi (cov_path )
10591086 elif os .path .exists (unit_path ):
10601087 self .api = UnitTestApi (unit_path )
@@ -1068,7 +1095,7 @@ def __init__(self, FullManageProjectName, build_dir, env, compiler, testsuite, c
10681095 self .api .commit = dummy
10691096 self .failed_count = 0
10701097 self .passed_count = 0
1071-
1098+
10721099#
10731100# GenerateXml - add any compound tests to the unit report
10741101#
@@ -1117,8 +1144,6 @@ def generate_unit(self):
11171144
11181145 level = env .compiler .name + "/" + env .testsuite .name + "/" + env .name
11191146 self .write_testcase (st , level , st .name , env .definition .is_monitored )
1120- from generate_qa_results_xml import saveQATestStatus
1121- saveQATestStatus (self .FullManageProjectName )
11221147
11231148 if self .topLevelAPI == None :
11241149 api .close ()
@@ -1566,19 +1591,19 @@ def __print_test_case_was_skipped(self, searchName, passed):
15661591 if self .verbose :
15671592 print ("skipping {} {} {}" .format (self .hashCode , searchName , passed ))
15681593
1569- def __generate_xml (xml_file , envPath , env , xmlCoverReportName , xmlTestingReportName ):
1594+ def __generate_xml (xml_file , envPath , env , xmlCoverReportName , xmlTestingReportName , teePrint ):
15701595 if xml_file .api == None :
1571- self . teePrint .teePrint ("\n Cannot find project file (.vcp or .vce): " + envPath + os .sep + env )
1596+ teePrint .teePrint ("\n Cannot find project file (.vcp or .vce): " + envPath + os .sep + env )
15721597
15731598 elif isinstance (xml_file , CoverApi ):
15741599 xml_file .generate_cover ()
1575- self . teePrint .teePrint ("\n vectorcast-coverage plugin for Jenkins compatible file generated: " + xmlCoverReportName )
1600+ teePrint .teePrint ("\n vectorcast-coverage plugin for Jenkins compatible file generated: " + xmlCoverReportName )
15761601
15771602 else :
15781603 xml_file .generate_unit ()
1579- self . teePrint .teePrint ("\n Junit plugin for Jenkins compatible file generated: " + xmlTestingReportName )
1604+ teePrint .teePrint ("\n Junit plugin for Jenkins compatible file generated: " + xmlTestingReportName )
15801605 xml_file .generate_cover ()
1581- self . teePrint .teePrint ("\n VCC plugin for Jenkins compatible file generated: " + xmlTestingReportName )
1606+ teePrint .teePrint ("\n VCC plugin for Jenkins compatible file generated: " + xmlTestingReportName )
15821607
15831608if __name__ == '__main__' :
15841609
@@ -1621,4 +1646,5 @@ def __generate_xml(xml_file, envPath, env, xmlCoverReportName, xmlTestingReportN
16211646 envPath ,
16221647 env ,
16231648 xmlCoverReportName ,
1624- xmlTestingReportName )
1649+ xmlTestingReportName ,
1650+ teePrint )
0 commit comments