Skip to content

Commit

Permalink
Remove hard-coded filter string to use an argument (#600)
Browse files Browse the repository at this point in the history
Removed hard-coded filter string for cdash and instead take in a
command line argument.
  • Loading branch information
achauphan committed Feb 6, 2024
1 parent c36530a commit 7579d35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def cdash_analyze_and_report_random_failures_run_case(
+ "/cdash_analyze_and_report_random_failures.py"
+ " --cdash-project-name='Project Name'"
+ " --group-name='Group Name'"
+ " --initial-nonpassing-test-filters='initial_nonpassing_test_filters'"
+ " --cdash-site-url='https://something.com/cdash'"
+ " --reference-date=2018-10-28"
+ " --write-email-to-file="+htmlFileName
Expand Down Expand Up @@ -232,7 +233,7 @@ def test_rft_1_ift_2(self):
"<h2>Random test failure scan results for Project Name from 2018-10-26 to 2018-10-28</h2>",

"<p>",
"<a href=\"https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&filtercount=2&showfilters=1&filtercombine=and&field1=status&compare1=63&value1=Failed&field2=groupname&compare2=63&value2=Pull%20Request\">Nonpassing tests scanned on CDash</a>=2<br>",
"<a href=\"https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&initial_nonpassing_test_filters\">Nonpassing tests scanned on CDash</a>=2<br>",
"</p",

"<p>",
Expand Down Expand Up @@ -270,7 +271,7 @@ def test_rft_0_ift_2(self):
"<h2>Random test failure scan results for Project Name from 2018-10-26 to 2018-10-28</h2>",

"<p>",
"<a href=\"https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&filtercount=2&showfilters=1&filtercombine=and&field1=status&compare1=63&value1=Failed&field2=groupname&compare2=63&value2=Pull%20Request\">Nonpassing tests scanned on CDash</a>=2<br>",
"<a href=\"https://something[.]com/cdash/queryTests[.]php[?]project=Project%20Name&begin=2018-10-26&end=2018-10-28&initial_nonpassing_test_filters\">Nonpassing tests scanned on CDash</a>=2<br>",
"</p>",

"<p>",
Expand Down
12 changes: 3 additions & 9 deletions tribits/ci_support/cdash_analyze_and_report_random_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def main():
# driver script or command line input
cdashSiteUrl = args.cdash_site_url
cdashProjectName = args.cdash_project_name
cdashInitialNonpassingTestFilters = args.initial_nonpassing_test_filters
date = args.reference_date
groupName = args.group_name
daysOfHistory = args.days_of_history
Expand All @@ -73,14 +74,6 @@ def main():

randomFailureSummaries = []

cdashInitialNonpassedTestsFilters = \
"filtercount=2&showfilters=1&filtercombine=and"+\
"&field1=status&compare1=63&value1=Failed"+\
"&field2=groupname&compare2=63&value2=Pull%20Request"
# TODO: This cdashNonpassedTestsFilters should be moved outside
# and into a project-specific driver script or taken as a
# command line input.

# A.1) Set up date range and directories

# Construct date range for queryTests filter string
Expand All @@ -99,7 +92,7 @@ def main():

# Construct queryTest.php filter for a date range
initialNonpassingTestQueryFilters = \
dateUrlField+"&"+cdashInitialNonpassedTestsFilters
dateUrlField+"&"+cdashInitialNonpassingTestFilters

# A.2) Create starting email body and html string aggregation var

Expand Down Expand Up @@ -302,6 +295,7 @@ def getCmndLineArgs():
parser = argparse.ArgumentParser("Arguments for cdash_analyze_and_report_random_failures.py")
parser.add_argument("--cdash-site-url", default="", required=True)
parser.add_argument("--cdash-project-name", default="", required=True)
parser.add_argument("--initial-nonpassing-test-filters", default="", required=True)
parser.add_argument("--reference-date", default="yesterday")
parser.add_argument("--group-name", default="Pull Request")
parser.add_argument("--days-of-history", default=1, type=int)
Expand Down

0 comments on commit 7579d35

Please sign in to comment.