aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2012-08-13 14:00:55 -0400
committerDiego Novillo <dnovillo@gcc.gnu.org>2012-08-13 14:00:55 -0400
commitc577382e7b00c09e89f0b0e8cff4361795f9499a (patch)
treec5ecf16dc9bbfbcd6c56c37913b6446d7b75177d
parent621bc04640ee2dd1894285c6a536c78c826d8d4e (diff)
downloadgcc-c577382e7b00c09e89f0b0e8cff4361795f9499a.zip
gcc-c577382e7b00c09e89f0b0e8cff4361795f9499a.tar.gz
gcc-c577382e7b00c09e89f0b0e8cff4361795f9499a.tar.bz2
Implement support for expiring expected results in validate_failures.py.
I noticed recently that while the validator was accepting the 'expire=YYYYMMDD' attribute, it was not actually doing anything with it. This patch fixes the oversight. 2012-08-13 Diego Novillo <dnovillo@google.com> * testsuite-management/validate_failures.py: Import datetime. (TestResult.ExpirationDate): New. (TestResult.HasExpired): New. (ParseSummary): Call it. If it returns True, warn that the expected failure has expired and do not add it to the set of expected results. (GetResults): Clarify documentation. From-SVN: r190351
-rw-r--r--contrib/ChangeLog10
-rwxr-xr-xcontrib/testsuite-management/validate_failures.py39
2 files changed, 45 insertions, 4 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index b1a1d5f..1967939 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,13 @@
+2012-08-13 Diego Novillo <dnovillo@google.com>
+
+ * testsuite-management/validate_failures.py: Import datetime.
+ (TestResult.ExpirationDate): New.
+ (TestResult.HasExpired): New.
+ (ParseSummary): Call it. If it returns True, warn that the
+ expected failure has expired and do not add it to the set of
+ expected results.
+ (GetResults): Clarify documentation.
+
2012-07-26 Diego Novillo <dnovillo@google.com>
* testsuite-management/validate_failures.py: Do not use
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index ef01938..0ac9b15 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -46,6 +46,7 @@ executed it will:
with exit code 0. Otherwise, it exits with error code 1.
"""
+import datetime
import optparse
import os
import re
@@ -135,6 +136,26 @@ class TestResult(object):
attrs = '%s | ' % self.attrs
return '%s%s: %s %s' % (attrs, self.state, self.name, self.description)
+ def ExpirationDate(self):
+ # Return a datetime.date object with the expiration date for this
+ # test result expires. Return None, if no expiration # has been set.
+ if re.search(r'expire=', self.attrs):
+ expiration = re.search(r'expire=(\d\d\d\d)(\d\d)(\d\d)', self.attrs)
+ if not expiration:
+ Error('Invalid expire= format in "%s". Must be of the form '
+ '"expire=YYYYMMDD"' % self)
+ return datetime.date(int(expiration.group(1)),
+ int(expiration.group(2)),
+ int(expiration.group(3)))
+ return None
+
+ def HasExpired(self):
+ # 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
+
def GetMakefileValue(makefile_name, value_name):
if os.path.exists(makefile_name):
@@ -178,7 +199,13 @@ def ParseSummary(sum_fname):
sum_file = open(sum_fname)
for line in sum_file:
if IsInterestingResult(line):
- result_set.add(TestResult(line))
+ result = TestResult(line)
+ if result.HasExpired():
+ # Tests that had an expiration set are not added to the
+ # set of expected results.
+ print 'WARNING: Expected failure "%s" has expired.' % line.strip()
+ continue
+ result_set.add(result)
sum_file.close()
return result_set
@@ -220,16 +247,20 @@ def GetResults(sum_files):
def CompareResults(manifest, actual):
"""Compare sets of results and return two lists:
- - List of results present in MANIFEST but missing from ACTUAL.
- List of results present in ACTUAL but missing from MANIFEST.
+ - List of results present in MANIFEST but missing from ACTUAL.
"""
- # Report all the actual results not present in the manifest.
+ # Collect all the actual results not present in the manifest.
+ # Results in this set will be reported as errors.
actual_vs_manifest = set()
for actual_result in actual:
if actual_result not in manifest:
actual_vs_manifest.add(actual_result)
- # Simlarly for all the tests in the manifest.
+ # Collect all the tests in the manifest that were not found
+ # in the actual results.
+ # Results in this set will be reported as warnings (since
+ # they are expected failures that are not failing anymore).
manifest_vs_actual = set()
for expected_result in manifest:
# Ignore tests marked flaky.