From f6c5995bc0d66c0e922af9c2ab29618425c2c4b3 Mon Sep 17 00:00:00 2001 From: Anderson Chauphan Date: Fri, 2 Feb 2024 16:12:06 -0700 Subject: [PATCH] Explicitly normalize groupName argument for use in Url request (#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. --- ...sh_analyze_and_report_random_failures_UnitTests.py | 11 ++++++----- .../cdash_analyze_and_report_random_failures.py | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) 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 ec59cdbd1..dbe0d5b05 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 @@ -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" + " " @@ -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" ], ) @@ -211,7 +212,7 @@ 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", @@ -219,7 +220,7 @@ def test_rand_1pass_1fail(self): "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", ], ) @@ -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", diff --git a/tribits/ci_support/cdash_analyze_and_report_random_failures.py b/tribits/ci_support/cdash_analyze_and_report_random_failures.py index e0017cea0..2b199a6a2 100755 --- a/tribits/ci_support/cdash_analyze_and_report_random_failures.py +++ b/tribits/ci_support/cdash_analyze_and_report_random_failures.py @@ -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 @@ -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") @@ -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')