[Piglit] [PATCH 00/44] Port framework to run on both python 2.7 and 3.3+

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Jan 27 16:06:08 PST 2016


From: Dylan Baker <baker.dylan.c at gmail.com>

This rather lengthy series incrementally ports the framework from
running only on python 2.7 to running on python 2.7 and 3.3+ (3.2 might
already work, but I haven't tested it. If there is interest in 3.2
support I'd rather worry about that after landing this series).

This approach uses six, which has already been used to hybrize the
generators to run under python 2 and 3. This is a compatibility library,
and should provide a fairly straight forward path to remove python 2.x
support when piglit is ready to make the transition to a pure 3.x
codebase.

I have made every effort to ensure that python 2.7 does not break
across the series for core piglit functionality. I've tested running,
aggregating, console and html summary, as well as both the JUnit and
JSON backends. All unittests also pass across the whole of the series.
Python 3 does not work fully until the end of the series.

As far as I can tell the dEQP based tests also work, at least by the end
of the series. I have not tested some of the external suites: igt, xts,
and opencv opencl have not been tested.

I'll admit that the series is a bit of a smattering of "fix this thing,
fix that thing" I've tried to organize some of the changes together,
particularly the six related changes. However, the series is big, and a
few of the patches (particularly the unicode/byte/str one) are very
invasive and moving them or anything from one side or the other is a
non-trivial amount of work.

Everything should continue to work as it did before, I've tried to
ensure that for Windows no new features (namely timeouts) get enabled in
python 3.x (I'll leave it up to someone using Windows to add that if
they want it), but I don't have a Windows system to test on.

This is available at my github:
https://github.com/dcbaker/piglit submit/hybrid-python

Dylan Baker (44):
  tox.ini: drop explicit coverage generation
  python: use future print, division, and absolute_import
  python: use six.moves.range
  framework: use six.moves.configparser
  framework: use six.moves.BaseHTTPServer shim
  unittests: use six.moves.getcwd
  framework: use six.moves.zip
  python: use six.moves.cStringIO
  framework/test/base.py: fix class/__slots__ conflict in python3
  framework: use six.add_metaclass
  python: use six unicode/bytes/str handling
  framework/compat.py: Add a small module with some extra compat
  framework/results.py: use compat
  python: use six.{iter,view}{items,keys,values}
  framework/profile.py: replace dictionary-comprehension with dict()
  framework/programs/run.py: use PIGLIT_CONFIG.safe_get
  unittests: try to import mock from unittest
  base_tests.py: make tests for timeout run on python 3.x
  framework/test/base.py: Make timeout work in python 3.x
  base_tests.py: Add tests for an exception in Test.execute
  unittests/results_tests.py: Add traceback tests
  framework,unittests: use __future__ unicode_literals
  opengl.py: fix bytes returned from wflinfo.
  compression.py: use the proper read and write modes for python
    versions
  unittest/utils.py: fix tempfile modes for python3
  framework/status.py: Add __hash__ method to NoChangeStatus
  dmesg.py: Fix str/bytes/unicode for python 2/3 compatibility
  status_tests.py: drop bytes tests, status doesn't support bytes
    anymore
  framework/results.py: fix StringDescriptor handling of bytes
  framework/test/base.py: fix compare to None in python 3
  framework/log.py: fix next() call
  log_tests.py: fix incompatible seek for python 3
  Framework/backends/junit.py: fix bytes/unicode handling on python3
  framework/backends/json.py: use text_type instead for str
  framework/core.py: make collect_system_info return unicode
  framework/test/glsl_parser_test.py: stop supporting bytes
  unittests/options_tests.py: fix mocking for python 3.x
  unittests/opengl_tests.py: stop mock leakage
  options_tests.py: Fix test that happened to work on python 2
  gen_dispatch.py: don't use tabs
  summary/html: fix python 3 encoding issues.
  CMake: Enable python 3.x for building
  piglit: change piglit command to python 3
  tox.ini: add python 3.3-3.5 for standard tests.

 CMakeLists.txt                                     |   4 +-
 framework/backends/__init__.py                     |   9 +-
 framework/backends/abstract.py                     |  11 +-
 framework/backends/compression.py                  | 238 +++++++++++----------
 framework/backends/json.py                         |  20 +-
 framework/backends/junit.py                        |  18 +-
 framework/backends/register.py                     |   5 +-
 .../summary_html_tests.py => framework/compat.py   |  32 +--
 framework/core.py                                  |  23 +-
 framework/dmesg.py                                 |  22 +-
 framework/exceptions.py                            |   8 +-
 framework/grouptools.py                            |  13 +-
 framework/log.py                                   |  18 +-
 framework/options.py                               |  10 +-
 framework/profile.py                               |  28 +--
 framework/programs/parsers.py                      |   6 +-
 framework/programs/run.py                          |  40 ++--
 framework/programs/summary.py                      |   8 +-
 framework/results.py                               |  32 +--
 framework/status.py                                |  38 ++--
 framework/summary/__init__.py                      |   6 +-
 framework/summary/common.py                        |  16 +-
 framework/summary/console_.py                      |  12 +-
 framework/summary/feature.py                       |   6 +-
 framework/summary/html_.py                         |  11 +-
 framework/test/__init__.py                         |   6 +-
 framework/test/base.py                             | 122 +++++++----
 framework/test/deqp.py                             |  12 +-
 framework/test/gleantest.py                        |   4 +-
 framework/test/glsl_parser_test.py                 |  31 ++-
 framework/test/gtest.py                            |   5 +-
 framework/test/oclconform.py                       |   5 +-
 framework/test/opencv.py                           |   5 +-
 framework/test/opengl.py                           |  10 +-
 framework/test/piglit_test.py                      |   4 +-
 framework/test/shader_test.py                      |  18 +-
 piglit                                             |   2 +-
 registry/gl.py                                     |   5 +-
 templates/feature.mako                             |   4 +-
 templates/index.mako                               |  10 +-
 templates/testrun_info.mako                        |   7 +-
 tests/all.py                                       |   8 +-
 tests/cl.py                                        |   4 +-
 tests/cpu.py                                       |   3 +
 tests/cts.py                                       |   4 +-
 tests/deqp_gles2.py                                |   4 +
 tests/deqp_gles3.py                                |   4 +
 tests/deqp_gles31.py                               |   4 +
 tests/es3conform.py                                |   4 +
 tests/glslparser.py                                |   4 +
 tests/gpu.py                                       |   4 +
 tests/igt.py                                       |   5 +-
 tests/llvmpipe.py                                  |   4 +
 tests/oglconform.py                                |   3 +
 tests/quick.py                                     |   4 +
 tests/quick_cl.py                                  |   4 +
 tests/sanity.py                                    |   4 +
 tests/shader.py                                    |   4 +
 tests/util/gen_dispatch.py                         |   6 +-
 tests/xts-render.py                                |   3 +
 tests/xts.py                                       |   4 +-
 tox.ini                                            |  16 +-
 unittests/backends_tests.py                        |   7 +-
 unittests/base_tests.py                            |  77 ++++++-
 unittests/compressed_backend_tests.py              |  12 +-
 unittests/core_tests.py                            |  11 +-
 unittests/deqp_tests.py                            |  11 +-
 unittests/dmesg_tests.py                           |  29 ++-
 unittests/exceptions_tests.py                      |   4 +-
 unittests/gleantest_tests.py                       |  10 +-
 unittests/glsl_parser_test_tests.py                |  16 +-
 unittests/grouptools_tests.py                      |   4 +-
 unittests/gtest_tests.py                           |   4 +-
 unittests/integration_tests.py                     |   4 +-
 unittests/json_backend_tests.py                    |   4 +-
 unittests/json_results_update_tests.py             |  12 +-
 unittests/json_tests.py                            |   4 +-
 unittests/junit_backends_tests.py                  |   4 +-
 unittests/log_tests.py                             |   6 +-
 unittests/oglconform_tests.py                      |  16 +-
 unittests/opencv_tests.py                          |   4 +-
 unittests/opengl_tests.py                          | 164 +++++++-------
 unittests/options_tests.py                         |  17 +-
 unittests/piglit_test_tests.py                     |  10 +-
 unittests/profile_tests.py                         |  10 +-
 unittests/results_tests.py                         |  52 +++--
 unittests/run_parser_tests.py                      |   4 +-
 unittests/shader_test_tests.py                     |  20 +-
 unittests/status_tests.py                          |  11 +-
 unittests/summary_common_tests.py                  |   7 +-
 unittests/summary_console_tests.py                 |   9 +-
 unittests/summary_html_tests.py                    |   7 +-
 unittests/test_lists.py                            |   4 +-
 unittests/utils.py                                 |  27 ++-
 94 files changed, 1017 insertions(+), 548 deletions(-)
 copy unittests/summary_html_tests.py => framework/compat.py (61%)

-- 
2.7.0



More information about the Piglit mailing list