Skip to content

Commit 32f8768

Browse files
committed
updates from testing
1 parent 5f57dec commit 32f8768

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

src/main/resources/scripts/generate-results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def buildReports(FullManageProjectName = None, level = None, envName = None, gen
539539
api.close()
540540
except:
541541
teePrint.teePrint(" *INFO: Issue getting tool version from: " + FullManageProjectName)
542-
traceback.print_exc()
542+
if print_exc: traceback.print_exc()
543543
use_manage_api = False
544544

545545
if use_manage_api:

src/main/resources/scripts/generate_sonarqube_testresults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def generate_unit(self):
603603
for func in unit.functions:
604604
if not func.is_non_testable_stub:
605605
for tc in func.testcases:
606-
if not isTcPlaceHolder(tc):
606+
if not self.isTcPlaceHolder(tc):
607607
if not tc.for_compound_only or tc.testcase_status == "TCR_STRICT_IMPORT_FAILED":
608608
self.write_testcase(tc, tc.function.unit.name, tc.function.display_name)
609609

src/main/resources/scripts/generate_xml.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,14 +815,52 @@ def generate_local_results(self, results, key):
815815
report_name = os.path.join("management", comp + "_" + ts + "_" + env_name + ".html")
816816
try:
817817
if isinstance(localXML.api, CoverApi):
818-
localXML.api.report(report_type="AGGREGATE_REPORT", formats=["HTML"], output_file=report_name)
818+
try:
819+
localXML.api.report(report_type="AGGREGATE_REPORT", formats=["HTML"], output_file=report_name)
820+
except:
821+
print("Failed to create " + report_name + " by CustomReport API. Using clicast directly")
822+
self.runAggregateReport(comp, ts, env_name, report_name)
819823
else:
820-
localXML.api.report(report_type="FULL_REPORT", formats=["HTML"], output_file=report_name)
824+
try:
825+
localXML.api.report(report_type="FULL_REPORT", formats=["HTML"], output_file=report_name)
826+
except:
827+
print("Failed to create " + report_name + " by CustomReport API. Using clicast directly")
828+
self.runFullReport(comp, ts, env_name, report_name)
821829
self.fixupReport(report_name)
822830
except:
823831
print("Error creating report", report_name + ". Contact Vector Support")
824832
parse_traceback.parse(traceback.format_exc(), self.verbose, self.compiler, self.testsuite, self.env, self.build_dir)
825833

834+
def runFullReport(self,comp,ts,env_name,report_name):
835+
try:
836+
from managewait import ManageWait
837+
cmd_prefix = os.environ.get('VECTORCAST_DIR') + os.sep
838+
callStr = cmd_prefix + "manage --project " + self.FullManageProjectName + " --level " + comp + "/" + ts + " --environment " + env_name + " --clicast-args report custom full"
839+
print(" ", callStr)
840+
manageWait = ManageWait(False, callStr, 1, 1)
841+
out = manageWait.exec_manage(True)
842+
for line in out.split("\n"):
843+
if "The HTML report was saved to" in line:
844+
fname = line.split("\"")[1]
845+
import shutil
846+
shutil.copyfile(fname, report_name)
847+
except:
848+
traceback.print_exc()
849+
def runAggregateReport(self,comp,ts,env_name,report_name):
850+
try:
851+
from managewait import ManageWait
852+
cmd_prefix = os.environ.get('VECTORCAST_DIR') + os.sep
853+
callStr = cmd_prefix + "manage --project " + self.FullManageProjectName + " --level " + comp + "/" + ts + " --environment " + env_name + " --clicast-args cover report aggregate"
854+
print(" ", callStr)
855+
manageWait = ManageWait(False, callStr, 1, 1)
856+
out = manageWait.exec_manage(True)
857+
for line in out.split("\n"):
858+
if "The HTML report was saved to" in line:
859+
fname = line.split("\"")[1]
860+
import shutil
861+
shutil.copyfile(fname, report_name)
862+
except:
863+
traceback.print_exc()
826864
def skipReporting(self, env):
827865

828866
build_dir = ""
@@ -1272,7 +1310,14 @@ def write_testcase(self, tc, unit_name, func_name, st_is_monitored = False, unit
12721310
fpath = filePath
12731311

12741312
if self.useStartLine:
1275-
startLine = str(tc.function.start_line)
1313+
try:
1314+
startLine = str(tc.function.start_line)
1315+
except:
1316+
try:
1317+
startLine = list(tc.cover_data.covered_statements)[0].start_line
1318+
except:
1319+
startLine = "0"
1320+
print("failed to access any start_line ", self.env, func_name, tc.name)
12761321
else:
12771322
startLine = "0"
12781323

0 commit comments

Comments
 (0)