Skip to content

Commit

Permalink
Merge pull request #15 from jenkinsci/FB90176_FB90219
Browse files Browse the repository at this point in the history
Fb90176 fb90219
  • Loading branch information
nbelliot committed Apr 29, 2020
2 parents 0a35f31 + 846e567 commit 3f122d0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
5 changes: 4 additions & 1 deletion src/main/resources/scripts/baseJenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ VC_FailurePhrases = ["No valid edition(s) available",
"NOT_LINKED",
"Preprocess Failed",
"Abnormal Termination on Environment",
"not recognized as an internal or external command"]
"not recognized as an internal or external command",
"Another Workspace with this path already exists",
"Destination directory or database is not writable"]

VC_UnstablePhrases = ["Value Line Error - Command Ignored", "groovy.lang","java.lang.Exception"]

// setup the manage project to have preset options
def setupManageProject() {
def cmds = """
_RM *_rebuild.html
_RM CombinedReport.html
_VECTORCAST_DIR/vpython "${env.WORKSPACE}"/vc_scripts/managewait.py --wait_time ${VC_waitTime} --wait_loops ${VC_waitLoops} --command_line "--project "${VC_Manage_Project}" ${VC_sharedArtifactDirectory} --status"
_VECTORCAST_DIR/vpython "${env.WORKSPACE}"/vc_scripts/managewait.py --wait_time ${VC_waitTime} --wait_loops ${VC_waitLoops} --command_line "--project "${VC_Manage_Project}" --force --release-locks"
_VECTORCAST_DIR/vpython "${env.WORKSPACE}"/vc_scripts/managewait.py --wait_time ${VC_waitTime} --wait_loops ${VC_waitLoops} --command_line "--project "${VC_Manage_Project}" --config VCAST_CUSTOM_REPORT_FORMAT=HTML"
Expand Down
55 changes: 34 additions & 21 deletions src/main/resources/scripts/generate_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from vector.apps.ReportBuilder.custom_report import fmt_percent
from operator import attrgetter
from vector.enums import COVERAGE_TYPE_TYPE_T
import hashlib

def dummy(*args, **kwargs):
return None
Expand Down Expand Up @@ -472,17 +473,11 @@ def write_testcase_jUnit(self, tc, unit_name, func_name):
exp_pass += summary.control_flow_total - summary.control_flow_fail
exp_total += summary.control_flow_total + summary.signals + summary.unexpected_exceptions

self.api.report(
testcases=[tc],
single_testcase=True,
report_type="Demo",
formats=["TEXT"],
output_file="execution_results.txt",
sections=[ "TESTCASE_SECTIONS"],
testcase_sections=["EXECUTION_RESULTS"])

result = open("execution_results.txt","r").read()
os.remove("execution_results.txt")
result = self.__get_testcase_execution_results(
tc,
classname,
unit_subp,
tc_name)

# Failure takes priority
if not tc.passed:
Expand Down Expand Up @@ -532,16 +527,12 @@ def write_testcase_xUnit(self, tc, unit_name, func_name):
if tc.passed:
msg = "PASS"
else:
self.api.report(
testcases=[tc],
single_testcase=True,
report_type="Demo",
formats=["TEXT"],
output_file="execution_results.txt",
sections=[ "TESTCASE_SECTIONS"],
testcase_sections=["EXECUTION_RESULTS"])

result = open("execution_results.txt","r").read()
result = self.__get_testcase_execution_results(
tc,
unit_name,
func_name,
tc_name)

result = cgi.escape(result)
result = result.replace("\"","")
result = result.replace("\n","
")
Expand Down Expand Up @@ -714,6 +705,28 @@ def was_test_case_skipped(self, tc, searchName):
traceback.print_exc()
sys.exit()

def __get_testcase_execution_results(self, tc, classname, unit_subp, tc_name):
report_name = hashlib.md5('.'.join(["execution_results",
classname,
unit_subp,
tc_name])).hexdigest()

self.api.report(
testcases=[tc],
single_testcase=True,
report_type="Demo",
formats=["TEXT"],
output_file=report_name,
sections=[ "TESTCASE_SECTIONS"],
testcase_sections=["EXECUTION_RESULTS"])

with open(report_name,"r") as f:
out = f.read()

os.remove(report_name)

return out

def __print_test_case_was_skipped(self, searchName, passed):
if self.verbose:
print("skipping ", self.hashCode, searchName, passed)

0 comments on commit 3f122d0

Please sign in to comment.