15 Piglit is a collection of automated tests for OpenGL and OpenCL
18 The goal of Piglit is to help improve the quality of open source
19 OpenGL and OpenCL drivers by providing developers with a simple means to
20 perform regression tests.
22 The original tests have been taken from
23 - Glean ( http://glean.sf.net/ ) and
24 - Mesa ( http://www.mesa3d.org/ )
30 First of all, you need to make sure that the following are installed:
34 - numpy (http://www.numpy.org)
35 - six (https://pypi.python.org/pypi/six)
36 - cmake (http://www.cmake.org)
37 - GL, glu and glut libraries and development packages (i.e. headers)
38 - X11 libraries and development packages (i.e. headers)
39 - waffle (http://www.waffle-gl.org)
42 Optionally, you can install the following:
44 - lxml. An accelerated python xml library using libxml2 (http://lxml.de/)
45 - simplejson. A fast C based implementation of the python json library.
46 (https://simplejson.readthedocs.org/en/latest/)
47 - jsonstreams. A JSON stream writer for python.
48 (https://jsonstreams.readthedocs.io/en/stable/)
50 For Python 2.x you can install the following to add features, these are
51 unnecessary for python3:
52 - backports.lzma. A packport of python3's lzma module to python2,
53 this enables fast native xz (de)compression in piglit for results files
54 (https://github.com/peterjc/backports.lzma)
55 - subprocess32. A backport of the subprocess from python3.2, which includes
56 timeout support. This only works for Linux
58 For testing the python framework using "py.test unittests/framework"
59 - py.test. A python test framework, used for running the python framework
61 - tox. A tool for testing python packages against multiple configurations of
62 python (https://tox.readthedocs.org/en/latest/index.html)
63 - mock. A python module for mocking other python modules. Required only for
64 unittests (https://github.com/testing-cabal/mock)
65 - psutil. A portable process library for python
66 - jsonschema. A JSON validator library for python
67 - pytest-mock. A mock plugin for pytest
68 - pytest-pythonpath. A plugin for pytest to do automagic with sys.path
69 - pytest-raises. A plugin for pytest that allows deocrating tests that expect
71 - pytest-warnings. A plugin for pytest that handles python warnings
72 - pytest-timeout. A plugin for pytest to timeout tests.
74 Now configure the build system:
78 This will start cmake's configuration tool, just follow the onscreen
79 instructions. The default settings should be fine, but I recommend you:
80 - Press 'c' once (this will also check for dependencies) and then
81 - Set "CMAKE_BUILD_TYPE" to "Debug"
82 Now you can press 'c' again and then 'g' to generate the build system.
91 On Linux, if cross-compiling a 32-bit build on a 64-bit host, then you must
92 invoke cmake with option "-DCMAKE_SYSTEM_PROCESSOR=i386".
98 Install development packages.
99 $ sudo apt-get install cmake g++ mesa-common-dev libgl1-mesa-dev python-numpy python-mako freeglut3-dev x11proto-gl-dev libxrender-dev libwaffle-dev
110 http://cmake.org/cmake/resources/software.html
111 Download and install 'Mac OSX Universal' platform.
114 http://developer.apple.com/xcode
122 glean will not build with MacOSX10.7.sdk. If you are trying to
123 build glean on Mac OS 10.7 (Lion), you will have to use MacOSX10.6.sdk.
125 Set 'CMAKE_OSX_SYSROOT' to '/Developer/SDKs/MacOSX10.6.sdk'. Configure.
133 Install development packages.
152 http://www.python.org/download
155 http://sourceforge.net/projects/numpy/files/NumPy
158 http://cmake.org/cmake/resources/software.html
159 Download and install 'Windows' platform.
161 Install Microsoft Visual Studio 2013 or later.
162 Install 'Visual C++' feature.
164 Download OpenGL Core API and Extension Header Files.
165 http://www.opengl.org/registry/#headers
166 Copy header files to MSVC.
167 C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL
170 http://www.pip-installer.org/en/latest/installing.html
173 > c:\Python27\Scripts\pip.exe install mako
179 Download freeglut for MSVC.
180 http://www.transmissionzero.co.uk/software/freeglut-devel
182 Open Visual Studio Command Prompt.
183 Start Menu->All Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt
184 CD to piglit directory.
187 > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .
190 - Use default native compilers
191 Set these variables in the Advanced view.
198 Build from the Visual Studio Command Prompt.
204 Download waffle for MSVC.
205 http://www.waffle-gl.org/
207 Open the Command Prompt.
208 CD to piglit directory.
211 > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .
213 - 'Visual Studio 12 2013', or
214 - 'Visual Studio 12 2013 Win64'
215 - Use default native compilers
216 Set these variables in the Advanced view.
217 Note that the values provided are for reference purposed and may differ on your system.
218 - PIGLIT_USE_WAFFLE, BOOL, TRUE
219 - WAFFLE_INCLUDE_DIRS, PATH, ${waffle_root}\include\waffle
220 - WAFFLE_LDFLAGS, FILEPATH, ${waffle_root}\lib\waffle-1.lib
221 - GLEXT_INCLUDE_DIR, PATH, C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL
226 Build from the Command Prompt.
232 Make sure that everything is set up correctly:
234 $ ./piglit run sanity results/sanity
236 You may include '.py' on the profile, or you may exclude it (sanity vs sanity.py),
237 both are equally valid.
239 You may also preface test profiles with tests/ (or any other path you like),
240 which may be useful for shell tab completion.
242 You may provide multiple profiles to be run at the same time:
244 $ ./piglit run quick_cl gpu deqp_gles3 results/gl-cl-combined
252 To learn more about the command's syntax.
254 Have a look into the tests/ directory to see what test profiles are available:
260 To create some nice formatted test summaries, run
262 $ ./piglit summary html summary/sanity results/sanity.results
264 Hint: You can combine multiple test results into a single summary.
265 During development, you can use this to watch for regressions:
267 $ ./piglit summary html summary/compare results/baseline.results results/current.results
269 You can combine as many testruns as you want this way (in theory;
270 the HTML layout becomes awkward when the number of testruns increases)
272 Have a look at the results with a browser:
274 $ xdg-open summary/sanity/index.html
276 The summary shows the 'status' of a test:
278 pass This test has completed successfully.
280 warn The test completed successfully, but something unexpected happened.
281 Look at the details for more information.
283 fail The test failed.
285 crash The test binary exited with a non-zero exit code
287 skip The test was skipped.
289 timeout The test ran longer than its allotted time and was forcibly killed.
292 There are also dmesg-* statuses. These have the same meaning as above, but are
293 triggered by dmesg related messages.
295 3.1 Environment Variables
296 -------------------------
298 There are a number of environment variables that control the way piglit
302 Overrides the compression method used. The same values that piglit.conf
303 allows for core:compression.
306 Overrides the platform run on. These allow the same values as ``piglit
307 run -p``. This values is honored by the tests themselves, and can be used
308 when running a single test.
310 PIGLIT_FORCE_GLSLPARSER_DESKTOP
311 Force glslparser tests to be run with the desktop (non-gles) version of
312 glslparsertest. This can be used to test ES<x>_COMPATABILITY extensions
316 Piglit has a mechanism run in the python layer for skipping tests with
317 unmet OpenGL or window system dependencies without starting a new
318 process (which is expensive). Sometimes this system doesn't work or is
319 undesirable, setting this environment variable to True will disable this
323 When this variable is true in python then any timeouts given by tests
324 will be ignored, and they will run until completion or they are killed.
329 The way 'piglit run' and 'piglit summary' count tests are different, 'piglit
330 run' counts the number of Test derived instance in the profile(s) selected,
331 while 'piglit summary' counts the number of subtests a result contains, or it's
332 result if there are no subtests. This means that the number shown by 'piglit
333 run' will be less than or equal to the number calculated by 'piglit summary'.
336 3.3 Shell Completions
337 ---------------------
339 Piglit has completions for bash, located in completions/bash/piglit. Once this
340 file is sourced into bash `piglit` and `./piglit` will have tab completion
341 available. For global availability place the file somewhere that bash will
342 source the file on startup. If piglit is installed and bash-completions are
343 available, then this completion file will be installed system-wide.
346 4. Available test sets
347 ----------------------
349 Test sets are specified as Python scripts in the tests directory.
350 The following test sets are currently available:
357 This suite contains minimal OpenGL sanity tests. These tests must
358 pass, otherwise the other tests will not generate reliable results.
361 This suite contains all OpenGL tests.
364 Run all tests, but cut down significantly on their runtime
365 (and thus on the number of problems they can find).
366 In particular, this runs Glean with the --quick option, which
367 reduces the number of visuals and state combinations tested.
370 A further reduced set of tests from quick.py, this runs tests only
371 for hardware functionality and not tests for the software stack.
374 A reduced set of tests from gpu.py removing tests that are problematic
378 This profile runs tests that don't touch the gpu, in other words all of
379 the tests in quick.py that are not run by gpu.py
382 A subset of all.py which runs only glslparser tests
385 A subset of all.py which runs only shader tests
392 This suite contains all OpenCL tests.
395 This runs all of the tests from cl.py as well as tests from opencv
399 4.3 External Integration
400 ------------------------
403 Support for running the X Test Suite using piglit.
406 Support for running Intel-gpu-tools test suite using piglit.
409 Support for running deQP's gles2 profile with piglit.
412 Support for running deQP's gles3 profile with piglit.
415 Support for running deQP's gles3.1 profile with piglit.
418 5. How to write tests
419 ---------------------
421 Every test is run as a separate process. This minimizes the impact that
422 severe bugs like memory corruption have on the testing process.
424 Therefore, tests can be implemented in an arbitrary standalone language.
425 C is the preferred language for compiled tests, piglit also supports its own
426 simple formats for test shaders and glsl parser input.
428 All new tests must be added to the appropriate profile, all.py profile for
429 OpenGL and cl.py for OpenCL. There are a few basic test classes supported by the
433 This is a test that is only used to integrate Glean tests
436 A shared base class for all native piglit tests.
438 It starts each test as a subprocess, captures stdout and stderr, and waits
439 for the test to return.
441 It provides test timeouts by setting the instances 'timeout' attribute to an
442 integer > 0 which is the number of seconds the test should run.
444 It interprets output by reading stdout and looking for 'PIGLIT: ' in the
445 output, and then reading any trailing characters as well formed json
446 returning the test result.
448 This is a base class and should not be used directly, but provides an
449 explanation of the behavior of the following classes.
452 A test class for native piglit OpenGL tests.
454 In addition to the properties of PiglitBaseTest it provides a mechanism for
455 detecting test window resizes and rerunning tests as well as keyword
456 arguments for platform requirements.
459 A test class for native piglit OpenCL tests.
461 It currently provides no special features.
464 A class for testing a glsl parser.
466 It is generally unnecessary to call this class directly as it uses a helper
467 function to search directories for tests.
470 A class for testing using OpenGL shaders.
472 It is generally unnecessary to call this class directly as it uses a helper
473 function to search directories for tests.
479 Piglit provides integration for other test suites as well. The rational for
480 this is that it provides piglit's one process per test protections (one test
481 crashing does not crash the whole suite), and access to piglit's reporting
484 Most integration is done through the use of piglit.conf, or through environment
485 variables, with piglit.conf being the preferred method.
491 Piglit provides a generic layer for dEQP based test suites, and specific
492 integration for several suites.
494 I suggest using Chad Versace's repo of dEQP, which contains a gbm target.
495 https://github.com/chadversary/deqp
497 It should be built as follows:
498 cmake . -DDEQP_TARGET=gbm -GNinja
500 Additional targets are available in the targets directory. gbm isn't compatible
501 for most (any?) blob driver, so another target might be necessary if that is a
502 requirement. One of the x11_* targets or drm is probably a good choice.
504 The use of ninja is optional.
506 Once dEQP is built add the following information to piglit.conf, which can
507 either be located in the root of the piglit repo, or in $XDG_CONFIG_HOME
508 (usually $HOME/.config).
512 bin=<deqp source dir>/modules/gles2/deqp-gles2
515 exe=<deqp source dir>/modules/gles3/deqp-gles3
518 bin=<deqp source dir>/modules/gles31/deqp-gles31
521 NOTE: for historical reasons gles3 uses 'exe' instead of 'bin'
523 These platforms can be run using deqp_gles*.py as a suite in piglit.
524 For example: ./piglit run deqp_gles31 my_results -c
526 It is also possible to mix integrated suites and piglit profiles together:
527 ./piglit run deqp_gles31 quick cl my_results
529 dEQP profiles generally contain all of the tests from the previous profile, so
530 gles31 covers gles3 and gles2.
536 Add the following to your piglit.conf file:
540 bin=<cts source dir>/cts/glcts