public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA 1/8] validate_failures.py: add TestResult ordinal
@ 2012-11-24 22:41 Doug Evans
  2012-11-25 15:30 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2012-11-24 22:41 UTC (permalink / raw)
  To: dnovillo, gcc-patches

Hi.
This set of 8 patch makes some minor tweaks to validate_failures.py,
and provides some new functionality.
They are relatively independent, but the patches are intended to be applied in order.

This first patch adds an ordinal to TestResult so that the sorting
keeps the tests in order of appearance.

Ok to check in?

2012-11-24  Doug Evans  <dje@google.com>

	* testsuite-management/validate_failures.py: Record ordinal with TestResult.

--- validate_failures.py=	2012-11-19 11:47:29.997632548 -0800
+++ validate_failures.py	2012-11-24 13:19:22.183836303 -0800
@@ -91,9 +91,12 @@ class TestResult(object):
     state: One of UNRESOLVED, XPASS or FAIL.
     name: File name for the test.
     description: String describing the test (flags used, dejagnu message, etc)
+    ordinal: Monotonically increasing integer.
+             It is used to keep results for one .exp file sorted
+             by the order the tests were run.
   """
 
-  def __init__(self, summary_line):
+  def __init__(self, summary_line, ordinal=-1):
     try:
       self.attrs = ''
       if '|' in summary_line:
@@ -109,6 +112,7 @@ class TestResult(object):
       self.attrs = self.attrs.strip()
       self.state = self.state.strip()
       self.description = self.description.strip()
+      self.ordinal = ordinal
     except ValueError:
       Error('Cannot parse summary line "%s"' % summary_line)
 
@@ -117,7 +121,8 @@ class TestResult(object):
             self.state, summary_line, self))
 
   def __lt__(self, other):
-    return self.name < other.name
+    return (self.name < other.name or
+            (self.name == other.name and self.ordinal < other.ordinal))
 
   def __hash__(self):
     return hash(self.state) ^ hash(self.name) ^ hash(self.description)
@@ -196,10 +201,14 @@ def IsInterestingResult(line):
 def ParseSummary(sum_fname):
   """Create a set of TestResult instances from the given summary file."""
   result_set = set()
+  # ordinal is used when sorting the results so that tests within each
+  # .exp file are kept sorted.
+  ordinal=0
   sum_file = open(sum_fname)
   for line in sum_file:
     if IsInterestingResult(line):
-      result = TestResult(line)
+      result = TestResult(line, ordinal)
+      ordinal += 1
       if result.HasExpired():
         # Tests that have expired are not added to the set of expected
         # results. If they are still present in the set of actual results,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA 1/8] validate_failures.py: add TestResult ordinal
  2012-11-24 22:41 [RFA 1/8] validate_failures.py: add TestResult ordinal Doug Evans
@ 2012-11-25 15:30 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2012-11-25 15:30 UTC (permalink / raw)
  To: Doug Evans; +Cc: gcc-patches

On Sat, Nov 24, 2012 at 5:41 PM, Doug Evans <dje@google.com> wrote:

> 2012-11-24  Doug Evans  <dje@google.com>
>
>         * testsuite-management/validate_failures.py: Record ordinal with TestResult.

OK.


Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-25 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-24 22:41 [RFA 1/8] validate_failures.py: add TestResult ordinal Doug Evans
2012-11-25 15:30 ` Diego Novillo

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).