summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2023-06-14 14:32:38 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2023-06-14 14:32:38 +0000
commit8396bb3905f1a90bf3558e61b27c8a72ee60ef63 (patch)
tree0c4f65f1210b78556d577f206f38768dd743c756
parent158e61d5202ce5c2c3247dc175c53e28154ae866 (diff)
validate_failures.py: Sync from upstream gcc.git
Change-Id: Ia32e1d5b391cf888f5580e3e205711bb3b9c98c1
-rwxr-xr-xcontrib/testsuite-management/validate_failures.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index 5375c77..4dfd9cd 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -1,11 +1,11 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
# Script to compare testsuite failures against a list of known-to-fail
# tests.
-#
+
# Contributed by Diego Novillo <dnovillo@google.com>
#
-# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+# Copyright (C) 2011-2023 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -74,7 +74,7 @@ _SUMMARY_LINE_FORMAT = '\n\t\t=== %s Summary ===\n'
_TOOL_LINE_REX = re.compile('^\t\t=== (.*) tests ===\n')
# Match .exp file name, optionally prefixed by a "tool:" name and a
# path ending with "testsuite/"
-_EXP_LINE_REX = re.compile('^Running (?:.*:)?(?:.*/testsuite/)?(.*) \.\.\.\n')
+_EXP_LINE_REX = re.compile('^Running (?:.*:)?(.*) \.\.\.\n')
_SUMMARY_LINE_REX = re.compile('^\t\t=== (.*) Summary ===\n')
# Subdirectory of srcdir in which to find the manifest file.
@@ -135,6 +135,9 @@ class TestResult(object):
(self.state,
self.name,
self.description) = _VALID_TEST_RESULTS_REX.match(summary_line).groups()
+ if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '':
+ self.description = re.sub(_OPTIONS.srcpath_regex, '',
+ self.description)
except:
print('Failed to parse summary line: "%s"' % summary_line,
file=sys.stderr)
@@ -258,7 +261,7 @@ class ResultSet(set):
def GetMakefileValue(makefile_name, value_name):
if os.path.exists(makefile_name):
- makefile = open(makefile_name)
+ makefile = open(makefile_name, encoding='latin-1', mode='r')
for line in makefile:
if line.startswith(value_name):
(_, value) = line.split('=', 1)
@@ -340,7 +343,7 @@ def ParseManifestWorker(result_set, manifest_path):
"""Read manifest_path, adding the contents to result_set."""
if _OPTIONS.verbosity >= 5:
print('Parsing manifest file %s.' % manifest_path)
- manifest_file = open(manifest_path)
+ manifest_file = open(manifest_path, encoding='latin-1', mode='r')
for orig_line in manifest_file:
line = orig_line.strip()
if line == "":
@@ -361,6 +364,9 @@ def ParseManifestWorker(result_set, manifest_path):
result_set.add(result)
elif IsExpLine(orig_line):
result_set.current_exp = _EXP_LINE_REX.match(orig_line).groups()[0]
+ if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '':
+ result_set.current_exp = re.sub(_OPTIONS.srcpath_regex, '',
+ result_set.current_exp)
elif IsToolLine(orig_line):
result_set.current_tool = _TOOL_LINE_REX.match(orig_line).groups()[0]
elif IsSummaryLine(orig_line):
@@ -383,7 +389,7 @@ def ParseSummary(sum_fname):
# ordinal is used when sorting the results so that tests within each
# .exp file are kept sorted.
ordinal=0
- sum_file = open(sum_fname)
+ sum_file = open(sum_fname, encoding='latin-1', mode='r')
for line in sum_file:
if IsInterestingResult(line):
result = result_set.MakeTestResult(line, ordinal)
@@ -400,6 +406,9 @@ def ParseSummary(sum_fname):
result_set.add(result)
elif IsExpLine(line):
result_set.current_exp = _EXP_LINE_REX.match(line).groups()[0]
+ if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '':
+ result_set.current_exp = re.sub(_OPTIONS.srcpath_regex, '',
+ result_set.current_exp)
result_set.testsuites.add((result_set.current_tool,
result_set.current_exp))
elif IsToolLine(line):
@@ -590,7 +599,7 @@ def ProduceManifest():
sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.build_dir)
actual = GetResults(sum_files)
- manifest_file = open(manifest_path, 'w')
+ manifest_file = open(manifest_path, encoding='latin-1', mode='w')
actual.Print(manifest_file)
actual.Print()
manifest_file.close()
@@ -640,6 +649,12 @@ def Main(argv):
help='Use provided date YYYYMMDD to decide whether '
'manifest entries with expiry settings have expired '
'or not. (default = Use today date)')
+ parser.add_option('--srcpath', action='store', type='string',
+ dest='srcpath_regex', default='[^ ]+/testsuite/',
+ help='Remove provided path (can be a regex) from '
+ 'the result entries. This is useful to remove '
+ 'occasional filesystem path from the results. '
+ '(default = "[^ ]+/testsuite/")')
parser.add_option('--inverse_match', action='store_true',
dest='inverse_match', default=False,
help='Inverse result sets in comparison. '
@@ -669,6 +684,7 @@ def Main(argv):
'Level 1: output unexpected failures. '
'Level 2: output unexpected passes. '
'Level 3: output helpful information. '
+ 'Level 4: output notification on expired entries. '
'Level 5: output debug information.')
global _OPTIONS
(_OPTIONS, _) = parser.parse_args(argv[1:])