diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2023-05-25 12:18:30 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2023-06-14 14:29:48 +0000 |
commit | 316b1d66d3d44fe4b64766a70ecb5d2f8569a5af (patch) | |
tree | 4b38741ed8a0983abbaeede064495dbfae5d4517 /contrib | |
parent | 22a0ade86cb5ccb6c8e8ff047a511374cbc799ce (diff) | |
download | gcc-316b1d66d3d44fe4b64766a70ecb5d2f8569a5af.zip gcc-316b1d66d3d44fe4b64766a70ecb5d2f8569a5af.tar.gz gcc-316b1d66d3d44fe4b64766a70ecb5d2f8569a5af.tar.bz2 |
[contrib] validate_failures.py: Add "--expiry_date YYYYMMDD" option
This option sets "today" date to compare expiration entries against.
Setting expiration date into the future allows re-detection of flaky
tests and creating fresh entries for them before the current flaky
entries expire.
contrib/ChangeLog:
* testsuite-management/validate_failures.py (TestResult): Update.
(Main): Handle new option "--expiry_date YYYYMMDD".
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/testsuite-management/validate_failures.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py index 6eb1acd..a77aabe 100755 --- a/contrib/testsuite-management/validate_failures.py +++ b/contrib/testsuite-management/validate_failures.py @@ -206,8 +206,7 @@ class TestResult(object): # Return True if the expiration date of this result has passed. expiration_date = self.ExpirationDate() if expiration_date: - now = datetime.date.today() - return now > expiration_date + return _OPTIONS.expiry_today_date > expiration_date class ResultSet(set): @@ -636,6 +635,11 @@ def Main(argv): default=False, help='When used with --produce_manifest, ' 'it will overwrite an existing manifest file ' '(default = False)') + parser.add_option('--expiry_date', action='store', + dest='expiry_today_date', default=None, + help='Use provided date YYYYMMDD to decide whether ' + 'manifest entries with expiry settings have expired ' + 'or not. (default = Use today date)') parser.add_option('--inverse_match', action='store_true', dest='inverse_match', default=False, help='Inverse result sets in comparison. ' @@ -670,6 +674,22 @@ def Main(argv): global _OPTIONS (_OPTIONS, _) = parser.parse_args(argv[1:]) + # Set "today" date to compare expiration entries against. + # Setting expiration date into the future allows re-detection of flaky + # tests and creating fresh entries for them before the current flaky entries + # expire. + if _OPTIONS.expiry_today_date: + today_date = re.search(r'(\d\d\d\d)(\d\d)(\d\d)', + _OPTIONS.expiry_today_date) + if not today_date: + Error('Invalid --expiry_today_date format "%s". Must be of the form ' + '"expire=YYYYMMDD"' % _OPTIONS.expiry_today_date) + _OPTIONS.expiry_today_date=datetime.date(int(today_date.group(1)), + int(today_date.group(2)), + int(today_date.group(3))) + else: + _OPTIONS.expiry_today_date = datetime.date.today() + if _OPTIONS.produce_manifest: retval = ProduceManifest() elif _OPTIONS.clean_build: |