[Piglit] [PATCH v3 0/3] Decouple JSON loading and python classes

Dylan Baker dylan at pnwbakers.com
Wed Oct 12 20:59:51 UTC 2016


Currently piglit's JSON format loading is tightly integrated with it's class
representations of result data. This has the advantage of reducing code
duplication, and making it easy to ensure that all data is correctly translated
to it's types. However, there is a drawback, the tight coupling makes changing
the JSON format difficult, and small changes have a tendency to break things.

This rather small series decouples the internal representation and the JSON
representation, which will allow makes changes to the format easier, but it does
have a bit of a cost: it drops support for older JSON results formats. This may
not be a big deal, most of these formats were quite old, and none of them had
formal schemas, but they may still exist.

I can add some of the formats back if they're really needed, but I like the fact
that getting rid of them removes 1000 lines of code from piglit.

This is available at my github:
https://github.com/dcbaker/piglit wip/detangle-json-load

v2: - remove support for '' extension for the JSON backend along with
      support for "main" files.
    - Fix result version being set to 9 instead of 8 in tests.
v3: - Remove the piglit_decoder and fix the .to_json and .from_dict
      methods of various classes to work correctly without the
      piglit_decoder.

Dylan Baker (3):
  framework/backends/json: replace str() with six.text_type()
  framework: Drop support for JSON formats < 7
  framework/backends/json: Don't convert to TestrunResult while updating

 framework/backends/json.py                       | 325 +-------
 framework/results.py                             |  19 +-
 unittests/framework/backends/test_json.py        |  35 +-
 unittests/framework/backends/test_json_update.py | 793 +----------------
 unittests/framework/test_results.py              |  19 +-
 5 files changed, 78 insertions(+), 1113 deletions(-)

-- 
git-series 0.8.10


More information about the Piglit mailing list