[Piglit] [PATCH 0/5] Refactor log module

Dylan Baker baker.dylan.c at gmail.com
Thu Jul 3 13:56:14 PDT 2014

Hopefully this is the last major overhaul to this code I have to do.

I'll start by saything that my first take at reworking the log module
wasn't as successful as I had hoped it would be. The performance was
better, but not as much as I'd hoped. The code was okay when it first
landed, but not great, and as more features were added (and bugs were
fixed) it the worse it got.

The biggest problem with the initial design was the use of a single
class that had too much to do. Too much state to manage, to many
different logical trees to follow, to many methods, and too many
options. So I took a different aproach, the state is held in a Manager
class, which creates Log instances for each test running. These tests do
a small amount of state work, but are mostly concerned with printing
information to the conosle.

This gives us a couple of advantages, first the seperation of code makes
the invidual peices much simpler than the previous implementation. The
second advantage is in exendability, it should be fairly easy to add new

Dylan Baker (5):
  framework/log.py: Merge Log.log() and Log.post_log()
  framework/log.py: Use keyword args to format instead of splat
  log.py: Makes method names clearer
  framework: refactor the log module
  framework: Add dummy logger that produces no output

 framework/core.py            |   5 +-
 framework/exectest.py        |   9 +-
 framework/log.py             | 307 +++++++++++++++++++++++++++++--------------
 framework/profile.py         |  10 +-
 framework/programs/run.py    |  26 ++--
 framework/results.py         |   6 +-
 framework/tests/log_tests.py | 179 ++++++++++++++++---------
 7 files changed, 353 insertions(+), 189 deletions(-)


More information about the Piglit mailing list