Skip to content

Commit

Permalink
Merge pull request #605 from achauphan/random-failure-tool-patch-2024…
Browse files Browse the repository at this point in the history
…-02-15

CDash Random failure tool patch 2024-02-15 (#600)
  • Loading branch information
bartlettroscoe authored Feb 19, 2024
2 parents 7b14c49 + 60421bf commit 58c744c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_random_failure(self):
"Found random failing tests: 1<br>",
"<br>Build name: build1",
"<br>Test name: testname1",
"<br>Test history URL: https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&filtercount=3&showfilters=1&filtercombine=and&field1=testname&compare1=63&value1=testname1&field2=groupname&compare2=63&value2=Group%20Name&field3=buildname&compare3=63&value3=buildname1",
"<br>Test history URL: <a href=\"https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&filtercount=3&showfilters=1&filtercombine=and&field1=testname&compare1=63&value1=testname1&field2=groupname&compare2=63&value2=Group%20Name&field3=buildname&compare3=63&value3=buildname1\">Link</a>",
"<br>Sha1 Pair : \('592ea0d5', 'b07e361c'\)",
"</p>"
],
Expand All @@ -229,7 +229,9 @@ def test_random_failure(self):

# Test to no random failure case starting from two initial failing tests (ift).
# Each ift has a test history containing multiple tests with passing and nonpassing results,
# but non share the same sha1 pair.
# but non share the same sha1 pair. This also tests the --email-subject-prefix argument
# and checks if it's present in the html page title, which is also used in the email subject
# line.
#
def test_no_random_failure(self):

Expand All @@ -247,7 +249,7 @@ def test_no_random_failure(self):
"PASSED \(rft=0, ift=2\): Project Name Group Name on 2018-10-26 to 2018-10-28"
],
htmlFileRegexList=[
"<h2>PASSED \(rft=0, ift=2\): Project Name Group Name on 2018-10-26 to 2018-10-28</h2>",
"<h2>Subject Prefix PASSED \(rft=0, ift=2\): Project Name Group Name on 2018-10-26 to 2018-10-28</h2>",

"<h2>Random test failure scan results for Project Name from 2018-10-26 to 2018-10-28</h2>",

Expand All @@ -260,7 +262,8 @@ def test_no_random_failure(self):
"</p>"
],
extraCmndLineOptionsList=[
"--days-of-history=3"
"--days-of-history=3",
"--email-subject-prefix='Subject Prefix '"
]
)

Expand Down
11 changes: 8 additions & 3 deletions tribits/ci_support/CDashAnalyzeReportRandomFailures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def runDriver(self):
writeEmailToFile = self.args.write_email_to_file
sendEmailFrom = self.args.send_email_from
sendEmailTo = self.args.send_email_to
emailSubjectPrefix = self.args.email_subject_prefix

randomFailureSummaries = []

Expand Down Expand Up @@ -231,11 +232,12 @@ def runDriver(self):
cdashReportData.htmlEmailBodyTop += "\n</p>"

defaultPageStyle = CDQAR.getDefaultHtmlPageStyleStr()
subjectLine = emailSubjectPrefix+summaryLine

if writeEmailToFile:
print("\nWriting HTML to file: "+writeEmailToFile+" ...")
htmlStr = CDQAR.getFullCDashHtmlReportPageStr(cdashReportData,
pageTitle=summaryLine, pageStyle=defaultPageStyle)
pageTitle=subjectLine, pageStyle=defaultPageStyle)
# print(htmlStr)
with open(writeEmailToFile, 'w') as outFile:
outFile.write(htmlStr)
Expand All @@ -247,7 +249,7 @@ def runDriver(self):
emailAddress = emailAddress.strip()
print("\nSending email to '"+emailAddress+"' ...")
msg=CDQAR.createHtmlMimeEmail(
sendEmailFrom, emailAddress, summaryLine, "", htmlStr)
sendEmailFrom, emailAddress, subjectLine, "", htmlStr)
CDQAR.sendMineEmail(msg)

def getCmndLineArgs(self):
Expand Down Expand Up @@ -290,6 +292,9 @@ def getCmndLineArgs(self):
parser.add_argument("--send-email-from", default="[email protected]",
help="Addressed sender of the script summary results email."+\
" [default='[email protected]']")
parser.add_argument("--email-subject-prefix", default="",
help="Prefix string added to the email subject line."+\
" [default='']")

self.args = parser.parse_args()

Expand Down Expand Up @@ -334,6 +339,6 @@ def singleSummaryReporter(self, cdashReportData):
cdashReportData.htmlEmailBodyTop += \
"\n<br>Build name: "+ self.buildName +\
"\n<br>Test name: "+ self.testName +\
"\n<br>Test history URL: "+ self.testHistoryUrl +\
"\n<br>Test history URL: <a href=\""+self.testHistoryUrl+"\">Link</a>" +\
"\n<br>Sha1 Pair : "+ str(self.sha1Pair)

0 comments on commit 58c744c

Please sign in to comment.