diff --git a/test/ci_support/cdash_analyze_and_report_random_failures_UnitTests.py b/test/ci_support/cdash_analyze_and_report_random_failures_UnitTests.py
index 1bff74833..03c2a60ef 100644
--- a/test/ci_support/cdash_analyze_and_report_random_failures_UnitTests.py
+++ b/test/ci_support/cdash_analyze_and_report_random_failures_UnitTests.py
@@ -217,7 +217,7 @@ def test_random_failure(self):
"Found random failing tests: 1
",
"
Build name: build1",
"
Test name: testname1",
- "
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",
+ "
Test history URL: Link",
"
Sha1 Pair : \('592ea0d5', 'b07e361c'\)",
"
"
],
@@ -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):
@@ -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=[
- "PASSED \(rft=0, ift=2\): Project Name Group Name on 2018-10-26 to 2018-10-28
",
+ "Subject Prefix PASSED \(rft=0, ift=2\): Project Name Group Name on 2018-10-26 to 2018-10-28
",
"Random test failure scan results for Project Name from 2018-10-26 to 2018-10-28
",
@@ -260,7 +262,8 @@ def test_no_random_failure(self):
""
],
extraCmndLineOptionsList=[
- "--days-of-history=3"
+ "--days-of-history=3",
+ "--email-subject-prefix='Subject Prefix '"
]
)
diff --git a/tribits/ci_support/CDashAnalyzeReportRandomFailures.py b/tribits/ci_support/CDashAnalyzeReportRandomFailures.py
index 4973bec16..d869e4872 100644
--- a/tribits/ci_support/CDashAnalyzeReportRandomFailures.py
+++ b/tribits/ci_support/CDashAnalyzeReportRandomFailures.py
@@ -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 = []
@@ -231,11 +232,12 @@ def runDriver(self):
cdashReportData.htmlEmailBodyTop += "\n"
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)
@@ -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):
@@ -290,6 +292,9 @@ def getCmndLineArgs(self):
parser.add_argument("--send-email-from", default="random-failure-script@noreply.org",
help="Addressed sender of the script summary results email."+\
" [default='random-failure-script@noreply.org']")
+ parser.add_argument("--email-subject-prefix", default="",
+ help="Prefix string added to the email subject line."+\
+ " [default='']")
self.args = parser.parse_args()
@@ -334,6 +339,6 @@ def singleSummaryReporter(self, cdashReportData):
cdashReportData.htmlEmailBodyTop += \
"\n
Build name: "+ self.buildName +\
"\n
Test name: "+ self.testName +\
- "\n
Test history URL: "+ self.testHistoryUrl +\
+ "\n
Test history URL: Link" +\
"\n
Sha1 Pair : "+ str(self.sha1Pair)