Patchwork Fix parsing bug in validate_patches.py

login
register
mail settings
Submitter Brooks Moses
Date May 31, 2013, 6:47 p.m.
Message ID <51A8F054.4040503@google.com>
Download mbox | patch
Permalink /patch/248004/
State New
Headers show

Comments

Brooks Moses - May 31, 2013, 6:47 p.m.
The validate_failures.py script in contrib/testsuite-management expects 
the first "|" character in a test summary line to be a delineator 
allowing the line to be prefixed by attributes such as "flaky".  This 
causes problems when a test line itself contains "|" in the message.

We can get around this in the xfail file by prefixing the line with "|" 
to indicate an empty attribute set.  However, validate_failures.py uses 
the same line-parser for files in the DejaGnu output, and we obviously 
can't adjust those -- with the result that the relevant summary line in 
the DejaGnu output is ignored.

This patch fixes the problem: If an entire line is a valid summary line, 
we don't try to split it.

Ok to commit?

- Brooks


----
2013-05-31  Brooks Moses  <bmoses@google.com>

	* validate_failures.py: Don't split already-valid summary lines.
Diego Novillo - June 4, 2013, 10:57 p.m.
On 2013-05-31 14:47 , Brooks Moses wrote:

> Index: contrib/testsuite-management/validate_failures.py
> ===================================================================
> --- contrib/testsuite-management/validate_failures.py    (revision 199390)
> +++ contrib/testsuite-management/validate_failures.py    (working copy)
> @@ -120,7 +120,7 @@
>    def __init__(self, summary_line, ordinal=-1):
>      try:
>        self.attrs = ''
> -      if '|' in summary_line:
> +      if '|' in summary_line and not 
> _VALID_TEST_RESULTS_REX.match(summary_line):

OK with this predicate factored into a predicate function (maybe 
SummaryLineHasAttributes?)


Thanks.  Diego.

Patch

The validate_failures.py script in contrib/testsuite-management expects the
first "|" character in a test summary line to be a delineator allowing the
line to be prefixed by attributes such as "flaky".  This causes problems when
a test line itself contains "|" in the message.

We can get around this in the xfail file by prefixing the line with "|" to
indicate an empty attribute set.  However, validate_failures.py uses the same
line-parser for files in the DejaGnu output, and we obviously can't adjust
those -- with the result that the relevant summary line in the DejaGnu output
is ignored.

This patch fixes the problem: If an entire line is a valid summary line, we don't
try to split it.

Index: contrib/testsuite-management/validate_failures.py
===================================================================
--- contrib/testsuite-management/validate_failures.py	(revision 199390)
+++ contrib/testsuite-management/validate_failures.py	(working copy)
@@ -120,7 +120,7 @@ 
   def __init__(self, summary_line, ordinal=-1):
     try:
       self.attrs = ''
-      if '|' in summary_line:
+      if '|' in summary_line and not _VALID_TEST_RESULTS_REX.match(summary_line):
         (self.attrs, summary_line) = summary_line.split('|', 1)
       try:
         (self.state,
@@ -210,7 +210,7 @@ 
 
 def IsInterestingResult(line):
   """Return True if line is one of the summary lines we care about."""
-  if '|' in line:
+  if '|' in line and not _VALID_TEST_RESULTS_REX.match(line):
     (_, line) = line.split('|', 1)
     line = line.strip()
   return bool(_VALID_TEST_RESULTS_REX.match(line))