Skip to content

Commit

Permalink
Explicitly normalize groupName argument for use in Url request (TriBI…
Browse files Browse the repository at this point in the history
…TSPub#600)

Normalize the groupName string before usage in a url request rather than
having the user input an already normalized string. This has the added benefit
of being able to use the groupName string without url normal characters
for output in upcoming summary lines.
  • Loading branch information
achauphan committed Feb 2, 2024
1 parent 76d98c0 commit f6c5995
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def cdash_analyze_and_report_random_failures_run_case(
cmnd = (
ciSupportDir
+ "/cdash_analyze_and_report_random_failures.py"
+ " --cdash-project-name='ProjectName'"
+ " --cdash-project-name='Project Name'"
+ " --group-name='Group Name'"
+ " --cdash-site-url='https://something.com/cdash'"
+ " --reference-date=2018-10-28"
+ " "
Expand Down Expand Up @@ -197,7 +198,7 @@ def test_base(self):
self.cdash_analyze_and_report_random_failures_run_case(
expectedRtnCode=0,
stdoutRegexList=[
"[*][*][*] CDash random failure analysis for ProjectName from 2018-10-28 to 2018-10-28",
"[*][*][*] CDash random failure analysis for Project Name Group Name from 2018-10-28 to 2018-10-28",
"Total number of initial failing tests: 1"
],
)
Expand All @@ -211,15 +212,15 @@ def test_rand_1pass_1fail(self):
expectedRtnCode=0,
stdoutRegexList=
[
"[*][*][*] CDash random failure analysis for ProjectName from 2018-10-28 to 2018-10-28",
"[*][*][*] CDash random failure analysis for Project Name Group Name from 2018-10-28 to 2018-10-28",
"Total number of initial failing tests: 1",

"Found randomly failing tests: 1",
"Test name: testname1",
"Build name: build1",
"Identical sha1 pairs: \(\'592ea0d5\', \'b07e361c\'\)",
"Test history browser URL:",
" https://something[.]com/cdash/queryTests[.]php[?]project=ProjectName&begin=2018-10-28&end=2018-10-28&filtercount=3&showfilters=1&filtercombine=and&field1=testname&compare1=63&value1=testname1&field2=groupname&compare2=63&value2=Pull%20Request&field3=buildname&compare3=63&value3=buildname1"
" https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-28&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",
],
)

Expand All @@ -236,7 +237,7 @@ def test_not_rand_3pass_2fail(self):
"\s+Build name: buildname1",
"\s+Size of test history: 5",

"[*][*][*] CDash random failure analysis for ProjectName from 2018-10-28 to 2018-10-28",
"[*][*][*] CDash random failure analysis for Project Name Group Name from 2018-10-28 to 2018-10-28",
"Total number of initial failing tests: 1",

"Found randomly failing tests: 0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ def main():
" Test name: "+nonpassingTest['testname']+"\n"+\
" Build name: "+correctedBuildName)

groupNameNormUrl, = CDQAR.normalizeUrlStrings(groupName)

cdashTestHistoryFilters = \
"filtercount=3&showfilters=1&filtercombine=and"+\
"&field1=testname&compare1=63&value1="+nonpassingTest['testname']+\
"&field2=groupname&compare2=63&value2="+groupName+\
"&field2=groupname&compare2=63&value2="+groupNameNormUrl+\
"&field3=buildname&compare3=63&value3="+correctedBuildName

testHistoryQueryFilters = dateUrlField+"&"+cdashTestHistoryFilters
Expand Down Expand Up @@ -201,7 +203,8 @@ def main():
testHistoryBrowserUrl, passingSha1Pair))


print("\n*** CDash random failure analysis for "+cdashProjectName+" from " +dateRangeStart+" to "+dateRangeEnd)
print("\n*** CDash random failure analysis for " +\
cdashProjectName+" "+groupName+" from " +dateRangeStr)

print("Total number of initial failing tests: "+str(len(initialNonpassingTestsLOD))+"\n")

Expand All @@ -218,7 +221,7 @@ def getCmndLineArgs():
parser.add_argument("--cdash-site-url", default="", required=True)
parser.add_argument("--cdash-project-name", default="", required=True)
parser.add_argument("--reference-date", default="yesterday")
parser.add_argument("--group-name", default="Pull%20Request")
parser.add_argument("--group-name", default="Pull Request")
parser.add_argument("--days-of-history", default=1, type=int)
parser.add_argument("--print-url-mode", choices=['none','initial','all'], default='none')

Expand Down

0 comments on commit f6c5995

Please sign in to comment.