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
This commit is contained in:
Diego Novillo 2012-08-13 14:00:55 -04:00 committed by Diego Novillo
parent 621bc04640
commit c577382e7b
2 changed files with 45 additions and 4 deletions

View File

@ -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

View File

@ -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.