This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: speeding up dg-extract-results.sh


Bernd Schmidt <bernds_cb1@t-online.de> writes:
> On 02/13/2014 10:18 AM, Richard Sandiford wrote:
>> contrib/
>> 	* dg-extract-results.py: New file.
>> 	* dg-extract-results.sh: Use it if the environment seems suitable.
>
> I'm now seeing the following:
>
> Traceback (most recent call last):
>    File "../../git/gcc/../contrib/dg-extract-results.py", line 581, in 
> <module>
>      Prog().main()
>    File "../../git/gcc/../contrib/dg-extract-results.py", line 569, in main
>      self.output_tool (self.runs[name])
>    File "../../git/gcc/../contrib/dg-extract-results.py", line 534, in 
> output_tool
>      self.output_variation (tool, variation)
>    File "../../git/gcc/../contrib/dg-extract-results.py", line 483, in 
> output_variation
>      for harness in sorted (variation.harnesses.values()):
> TypeError: unorderable types: HarnessRun() < HarnessRun()
>
> $ /usr/bin/python --version
> Python 3.3.3

Sorry, thought I'd tested it with python3, but obviously not.
I've applied the fix below after testing that it didn't change the
output for python 2.6 and python 2.7.

Thanks,
Richard


contrib/
	* dg-extract-results.py (Named): Remove __cmp__ method.
	(output_variation): Use a key to sort variation.harnesses.

Index: contrib/dg-extract-results.py
===================================================================
--- contrib/dg-extract-results.py	2014-05-25 10:32:31.822202922 +0100
+++ contrib/dg-extract-results.py	2014-05-25 10:33:30.811758127 +0100
@@ -11,6 +11,7 @@ import sys
 import getopt
 import re
 from datetime import datetime
+from operator import attrgetter
 
 # True if unrecognised lines should cause a fatal error.  Might want to turn
 # this on by default later.
@@ -24,9 +25,6 @@ class Named:
     def __init__ (self, name):
         self.name = name
 
-    def __cmp__ (self, other):
-        return cmp (self.name, other.name)
-
 class ToolRun (Named):
     def __init__ (self, name):
         Named.__init__ (self, name)
@@ -480,7 +478,8 @@ class Prog:
     # with a summary at the end.
     def output_variation (self, tool, variation):
         self.output_segment (variation.header)
-        for harness in sorted (variation.harnesses.values()):
+        for harness in sorted (variation.harnesses.values(),
+                               key = attrgetter ('name')):
             sys.stdout.write ('Running ' + harness.name + ' ...\n')
             if self.do_sum:
                 # Keep the original test result order if there was only


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]