public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1816] [contrib] validate_failures.py: Be more stringent in parsing result lines
@ 2023-06-14 14:31 Maxim Kuvyrkov
  0 siblings, 0 replies; only message in thread
From: Maxim Kuvyrkov @ 2023-06-14 14:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4d776a341309cee59bfcb72bba8ae8442d05db7

commit r14-1816-gd4d776a341309cee59bfcb72bba8ae8442d05db7
Author: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Date:   Thu Jun 1 12:05:08 2023 +0000

    [contrib] validate_failures.py: Be more stringent in parsing result lines
    
    Before this patch we would identify malformed line
    "UNRESOLVEDTest run by tcwg-buildslave on Mon Aug 23 10:17:50 2021"
    as an interesting result, only to fail in TestResult:__init__ due
    to missing ":" after UNRESOLVED.
    
    This patch makes all places that parse result lines use a single
    compiled regex.
    
    contrib/ChangeLog:
    
            * testsuite-management/validate_failures.py (_VALID_TEST_RESULTS_REX):
            Update.
            (TestResult): Use _VALID_TEST_RESULTS_REX.

Diff:
---
 contrib/testsuite-management/validate_failures.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index 26ea1d6f53b..f2d7b099d78 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -60,9 +60,10 @@ import os
 import re
 import sys
 
-# Handled test results.
 _VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ]
-_VALID_TEST_RESULTS_REX = re.compile("%s" % "|".join(_VALID_TEST_RESULTS))
+# <STATE>: <NAME> <DESCRIPTION"
+_VALID_TEST_RESULTS_REX = re.compile('(%s):\s*(\S+)\s*(.*)'
+                                     % "|".join(_VALID_TEST_RESULTS))
 
 # Formats of .sum file sections
 _TOOL_LINE_FORMAT = '\t\t=== %s tests ===\n'
@@ -131,8 +132,7 @@ class TestResult(object):
       try:
         (self.state,
          self.name,
-         self.description) = re.match(r'([A-Z]+):\s*(\S+)\s*(.*)',
-                                      summary_line).groups()
+         self.description) = _VALID_TEST_RESULTS_REX.match(summary_line).groups()
       except:
         print('Failed to parse summary line: "%s"' % summary_line)
         raise

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-14 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 14:31 [gcc r14-1816] [contrib] validate_failures.py: Be more stringent in parsing result lines Maxim Kuvyrkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).