diff mbox

RFA: speeding up dg-extract-results.sh

Message ID 87tx8efbff.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford May 25, 2014, 9:35 a.m. UTC
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.

Comments

Bernd Schmidt June 12, 2014, 3:53 p.m. UTC | #1
On 05/25/2014 11:35 AM, Richard Sandiford wrote:
> 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.

I've recently been trying to add ada to my set of tested languages, and 
I now encounter the following:

Traceback (most recent call last):
   File "../../git/gcc/../contrib/dg-extract-results.py", line 580, in 
<module>
     Prog().main()
   File "../../git/gcc/../contrib/dg-extract-results.py", line 544, in main
     self.parse_file (filename, file)
   File "../../git/gcc/../contrib/dg-extract-results.py", line 427, in 
parse_file
     self.parse_acats_run (filename, file)
   File "../../git/gcc/../contrib/dg-extract-results.py", line 342, in 
parse_acats_run
     self.parse_run (filename, file, tool, variation, 1)
   File "../../git/gcc/../contrib/dg-extract-results.py", line 242, in 
parse_run
     line = file.readline()
   File "/usr/lib64/python3.3/codecs.py", line 301, in decode
     (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 
5227: invalid continuation byte


Bernd
Mike Stump June 12, 2014, 4:32 p.m. UTC | #2
On Jun 12, 2014, at 8:53 AM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> I've recently been trying to add ada to my set of tested languages, and I now encounter the following:
> 
>  File "../../git/gcc/../contrib/dg-extract-results.py", line 242, in parse_run
>    line = file.readline()
>  File "/usr/lib64/python3.3/codecs.py", line 301, in decode
>    (result, consumed) = self._buffer_decode(data, self.errors, final)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 5227: invalid continuation byte

In the old skool world, these are byte sequences that end in ‘\n’…  no decoding errors are possible…  well, maybe one, if you tried to put ‘\0’ in the stream.  :-(  Maybe a LANG/LC type person can suggest an environment variable to set that would make things happier, else we’re down to a python person to solve from that side.  My knee jerk would be LANG=c for the entire test suite run...
diff mbox

Patch

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