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

Jon Severinsson jon at severinsson.net
Fri Apr 12 16:39:42 PDT 2013

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

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.
      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.
      framework: Use print as a function.
      framework: Don't use automatic tuple parameter unpacking.
      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]

 framework/core.py             |   70 ++++++++++++++++++++++++-----------------
 framework/exectest.py         |  164 ++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------
 framework/gleantest.py        |    6 ++--
 framework/glsl_parser_test.py |   27 +++++++++++-----
 framework/junit.py            |    4 +--
 framework/log.py              |    6 +++-
 framework/shader_test.py      |    4 ++-
 framework/summary.py          |   27 ++++++++++------
 framework/threadpool.py       |   59 +++++++++++++++++-----------------
 framework/threads.py          |   11 +++++--
 piglit-merge-results.py       |    6 ++--
 piglit-print-commands.py      |    2 +-
 piglit-run.py                 |   21 +++++++------
 piglit-summary-html.py        |   32 ++++++++++++-------
 piglit-summary-junit.py       |    2 +-
 templates/index.css           |    8 ++---
 tests/all.tests               |    8 ++++-
 tests/gtf.tests               |   10 +++---
 18 files changed, 263 insertions(+), 204 deletions(-)

More information about the Piglit mailing list