[Piglit] [PATCH 00/20] Piglit framework patches for Python 3.3 and test timeout

Kenneth Graunke kenneth at whitecape.org
Wed Apr 17 00:44:37 PDT 2013


On 04/12/2013 04:39 PM, Jon Severinsson wrote:
> Hi everyone
>
> A few days ago I left a computer running piglit over night, only to return
> to the computer 13 hours later to find that it had spent the last 12 hours
> on a single test that never completed...
>
> Somewhat irritated I dug into the code with the goal of adding a timeout
> to the tests, so that wouldn't happen again. I soon discovered that
> python only added support for timeouts to its subprocess module in 3.3,

Yeah, those are really nice.  It can be emulated pretty easily on 
earlier pythons as well, but just having it as part of the standard 
library is much better.

> and that piglit wasn't ported to Python 3 yet. Never having ported a
> Python project before, I thought "how hard can it be?" and went at it.
> After spending way too many hours hacking piglit, I now finally have
> piglit-run.py and piglit-summary-html.py running well on both Python 2.7
> and 3.3. It *should* work on any Python >= 2.6, but I have only tested
> 2.7 and 3.3.

This is really cool!  I had no idea it was possible to make a program 
run on both 2.x and 3.x.  Nice work!  This makes it easy to merge these 
patches today.  Then, if we get buy-in about switching to Python 3, we 
can drop 2.7 compatibility.

> The first 15 patches are all needed to get piglit to run on Python 3.x,
> the next three are cleanups I did along the way, and the last two patches
> are the timeout work I wanted to do in the first place.
>
> As I haven't worked on piglit before, and because my Python-fu isn't quite
> what it should be for an undertaking this size, I would very much like if
> someone would take the time to thoroughly review these patches...
>
> Best regards
> Jon Severinsson
>
>
> Jon Severinsson (20):
>        framework: Fix "inconsistent use of tabs and spaces in indentation" warnings.
>        framework: Consistently use Python 2.6+ syntax for exception objects.
>        framework: Consistently use Python 2.2+ syntax for dictionary key checks.

I've merged these three as they seemed fine.  2.2...yikes!

>        framework: Update import statements to support Python 3.x in addition to 2.x.
>        framework: Update unicode handling of subprocess output to support Python 3.x as well as 2.x.
>        framework: Fix unicode handling of command line arguments.
>        framework: Treat wglinfo, glxinfo and lspci output as text, not binary data.
>        framework: Catch "No such file or directory" by errno, not strerr.

I also merged this one.

>        framework: Use print as a function.
>        framework: Don't use automatic tuple parameter unpacking.

And this one.  I have comments about a few and will continue reviewing 
the rest...

>        framework: Port from execfile to compile & exec (required by python 3.x)
>        framework: Port from string.find to str.find (required by python 3.x)
>        framework: Update sequence type usage to support Python 3.x as well as Python 2.x.
>        framework: Update string type checking to work on both Python 2.x and Python 3.x
>        framework: Open summary files in binary mode, as we are doing the utf-8 encoding manually before writing.
>        framework: Treat all termination by signal as crashes.
>        framework: Simplify flow control in ExecTest.run().
>        framework: Improve the ExecTest run() and get_command_result() implementation.
>        framework: Add support for a "timeout" result code.
>        framework: Kill tests running for more than an hour [Python 3.3+ only]


More information about the Piglit mailing list