aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-11-30 21:53:34 +0000
committerDoug Evans <devans@gcc.gnu.org>2012-11-30 21:53:34 +0000
commitd5651dcfe8b168b8e91a7fe1d32bc955187f9177 (patch)
tree2f5f5fe86efcc83808ebfc80fc481c27ba382940
parentf6fce9517e41866fe436d4dcb3d4bb934ec61d0b (diff)
downloadgcc-d5651dcfe8b168b8e91a7fe1d32bc955187f9177.zip
gcc-d5651dcfe8b168b8e91a7fe1d32bc955187f9177.tar.gz
gcc-d5651dcfe8b168b8e91a7fe1d32bc955187f9177.tar.bz2
validate_failures.py: Add support for @include, @remove directives in manifest files.
* testsuite-management/validate_failures.py: Add support for @include, @remove directives in manifest files. From-SVN: r194008
-rw-r--r--contrib/ChangeLog3
-rwxr-xr-xcontrib/testsuite-management/validate_failures.py72
2 files changed, 70 insertions, 5 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 09b3816..cc1c8df 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,5 +1,8 @@
2012-11-30 Doug Evans <dje@google.com>
+ * testsuite-management/validate_failures.py: Add support for @include,
+ @remove directives in manifest files.
+
* testsuite-management/validate_failures.py: Add function
GetManifestPath. New global _MANIFEST_SUBDIR.
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index 35ea29b..483f466 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -44,6 +44,14 @@ executed it will:
b- Failures in the build not expected in the manifest.
6- If all the build failures are expected in the manifest, it exits
with exit code 0. Otherwise, it exits with error code 1.
+
+Manifest files contain expected DejaGNU results that are otherwise
+treated as failures.
+They may also contain additional text:
+
+# This is a comment. - self explanatory
+@include file - the file is a path relative to the includer
+@remove result text - result text is removed from the expected set
"""
import datetime
@@ -192,11 +200,13 @@ def ValidBuildDirectory(builddir, target):
return True
+def IsComment(line):
+ """Return True if line is a comment."""
+ return line.startswith('#')
+
+
def IsInterestingResult(line):
- """Return True if the given line is one of the summary lines we care about."""
- line = line.strip()
- if line.startswith('#'):
- return False
+ """Return True if line is one of the summary lines we care about."""
if '|' in line:
(_, line) = line.split('|', 1)
line = line.strip()
@@ -206,6 +216,58 @@ def IsInterestingResult(line):
return False
+def IsInclude(line):
+ """Return True if line is an include of another file."""
+ return line.startswith("@include ")
+
+
+def GetIncludeFile(line, includer):
+ """Extract the name of the include file from line."""
+ includer_dir = os.path.dirname(includer)
+ include_file = line[len("@include "):]
+ return os.path.join(includer_dir, include_file.strip())
+
+
+def IsNegativeResult(line):
+ """Return True if line should be removed from the expected results."""
+ return line.startswith("@remove ")
+
+
+def GetNegativeResult(line):
+ """Extract the name of the negative result from line."""
+ line = line[len("@remove "):]
+ return line.strip()
+
+
+def ParseManifestWorker(result_set, manifest_path):
+ """Read manifest_path, adding the contents to result_set."""
+ if options.verbosity >= 1:
+ print 'Parsing manifest file %s.' % manifest_path
+ manifest_file = open(manifest_path)
+ for line in manifest_file:
+ line = line.strip()
+ if line == "":
+ pass
+ elif IsComment(line):
+ pass
+ elif IsNegativeResult(line):
+ result_set.remove(TestResult(GetNegativeResult(line)))
+ elif IsInclude(line):
+ ParseManifestWorker(result_set, GetIncludeFile(line, manifest_path))
+ elif IsInterestingResult(line):
+ result_set.add(TestResult(line))
+ else:
+ Error('Unrecognized line in manifest file: %s' % line)
+ manifest_file.close()
+
+
+def ParseManifest(manifest_path):
+ """Create a set of TestResult instances from the given manifest file."""
+ result_set = set()
+ ParseManifestWorker(result_set, manifest_path)
+ return result_set
+
+
def ParseSummary(sum_fname):
"""Create a set of TestResult instances from the given summary file."""
result_set = set()
@@ -237,7 +299,7 @@ def GetManifest(manifest_path):
If no manifest file exists for this target, it returns an empty set.
"""
if os.path.exists(manifest_path):
- return ParseSummary(manifest_path)
+ return ParseManifest(manifest_path)
else:
return set()