This patch implements a bit of refactoring of the validate_failures.py script
in contrib/testsuite-management. In the script, there are two separate
locations where a (potential) summary line is split off from any preceding
attributes and extraneous whitespace is stripped. This patch refactors those
into calls to a single SplitAttributesFromSummaryLine function.
In addition, a couple of bugs are fixed in the process.
First, validate_failures.py has problems with test lines that contain a "|"
character in the actual message, because the DejaGnu output will be split
at the "|" as if it is prefixed by attributes, and the remainder is then
discarded as it does not match the pattern for a valid summary line. Thus,
we only split a line if it is not already valid.
Second, we do not correctly handle xfailing of lines where the description
is empty, as occurs occasionally in tests such as the libstdc++-abi/abi_check
test. This patch fixes that by adjusting the regular-expression matching to
allow for the absence of whitespace after the name.
Finally, the comment for "expected results not present" has been clarified to
account for the cases such as when a given testsuite simply wasn't run.
@@ -119,20 +119,15 @@
def __init__(self, summary_line, ordinal=-1):
- self.attrs = ''
- if '|' in summary_line:
- (self.attrs, summary_line) = summary_line.split('|', 1)
+ (self.attrs, summary_line) = SplitAttributesFromSummaryLine(summary_line)
- self.description) = re.match(r' *([A-Z]+):\s*(\S+)\s+(.*)',
+ self.description) = re.match(r'([A-Z]+):\s*(\S+)\s*(.*)',
print 'Failed to parse summary line: "%s"' % summary_line
- self.attrs = self.attrs.strip()
- self.state = self.state.strip()
- self.description = self.description.strip()
self.ordinal = ordinal
Error('Cannot parse summary line "%s"' % summary_line)
@@ -208,11 +203,20 @@
+ """Splits off attributes from a summary line, if present."""
+ if '|' in line and not _VALID_TEST_RESULTS_REX.match(line):
+ (attrs, line) = line.split('|', 1)
+ attrs = attrs.strip()
+ attrs = ''
+ line = line.strip()
+ return (attrs, line)
"""Return True if line is one of the summary lines we care about."""
- if '|' in line:
- (_, line) = line.split('|', 1)
- line = line.strip()
+ (_, line) = SplitAttributesFromSummaryLine(line)
@@ -416,8 +420,9 @@
if not ignore_missing_failures and len(expected_vs_actual) > 0:
PrintSummary('Expected results not present in this build (fixed tests)'
'\n\nNOTE: This is not a failure. It just means that these '
- 'tests were expected\nto fail, but they worked in this '
- 'configuration.\n', expected_vs_actual)
+ 'tests were expected\nto fail, but either they worked in '
+ 'this configuration or they were not\npresent at all.\n',
print '\nSUCCESS: No unexpected failures.'