16 Piglit is a collection of automated tests for OpenGL and OpenCL
19 The goal of Piglit is to help improve the quality of open source
20 OpenGL and OpenCL drivers by providing developers with a simple means to
21 perform regression tests.
23 The original tests have been taken from
24 - Glean ( http://glean.sf.net/ ) and
25 - Mesa ( http://www.mesa3d.org/ )
31 First of all, you need to make sure that the following are installed:
33 - Python 2.7.x or >=3.4
35 - numpy (http://www.numpy.org)
36 - six (https://pypi.python.org/pypi/six)
37 - cmake (http://www.cmake.org)
38 - GL, glu and glut libraries and development packages (i.e. headers)
39 - X11 libraries and development packages (i.e. headers)
40 - waffle (http://www.waffle-gl.org)
43 Optionally, you can install the following:
45 - lxml. An accelerated python xml library using libxml2 (http://lxml.de/)
46 - simplejson. A fast C based implementation of the python json library.
47 (https://simplejson.readthedocs.org/en/latest/)
48 - jsonstreams. A JSON stream writer for python.
49 (https://jsonstreams.readthedocs.io/en/stable/)
50 - VkRunner. A shader script testing tool for Vulkan.
51 (https://github.com/igalia/vkrunner)
53 For Python 2.x you can install the following to add features, these are
54 unnecessary for python3:
55 - backports.lzma. A backport of python3's lzma module to python2,
56 this enables fast native xz (de)compression in piglit for results files
57 (https://github.com/peterjc/backports.lzma)
58 - subprocess32. A backport of the subprocess from python3.2, which includes
59 timeout support. This only works for Linux
61 For testing the python framework using `py.test unittests/framework`
62 - py.test. A python test framework, used for running the python framework
64 - tox. A tool for testing python packages against multiple configurations of
65 python (https://tox.readthedocs.org/en/latest/index.html)
66 - mock. A python module for mocking other python modules. Required only for
67 unittests (https://github.com/testing-cabal/mock)
68 - psutil. A portable process library for python
69 - jsonschema. A JSON validator library for python
70 - pytest-mock. A mock plugin for pytest
71 - pytest-pythonpath. A plugin for pytest to do automagic with sys.path
72 - pytest-raises. A plugin for pytest that allows decorating tests that expect
74 - pytest-warnings. A plugin for pytest that handles python warnings
75 - pytest-timeout. A plugin for pytest to timeout tests.
77 Now configure the build system:
81 This will start cmake's configuration tool, just follow the onscreen
82 instructions. The default settings should be fine, but I recommend you:
83 - Press 'c' once (this will also check for dependencies) and then
84 - Set `CMAKE_BUILD_TYPE` to `Debug` Now you can press 'c' again and then 'g' to generate the build system.
90 ### 2.1 Cross Compiling
92 On Linux, if cross-compiling a 32-bit build on a 64-bit host, first make sure
93 you didn't have CMakeCache.txt file left from 64-bit build (it would retain old
94 flags), then you must invoke cmake with options
95 `-DCMAKE_SYSTEM_PROCESSOR=x86 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32`.
100 Install development packages.
102 $ 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
113 http://cmake.org/cmake/resources/software.html
114 Download and install 'Mac OSX Universal' platform.
117 http://developer.apple.com/xcode
127 Install development packages.
146 http://www.python.org/download
149 http://cmake.org/cmake/resources/software.html
150 Download and install 'Windows' platform.
152 Download and install Ninja
153 https://github.com/ninja-build/ninja/releases
156 https://mingw-w64.org/
158 Download OpenGL Core API and Extension Header Files.
159 http://www.opengl.org/registry/#headers
160 Pass `-DGLEXT_INCLUDE_DIR=/path/to/headers`
173 Download freeglut for Mingw.
174 http://www.transmissionzero.co.uk/software/freeglut-devel/
176 cmake -H. -Bbuild -G "Ninja" -DGLEXT_INCLUDE_DIR=\path\to\glext -DGLUT_INCLUDE_DIR=\path\to\freeglut\include -DGLUT_glut_LIBRARY=\path\to\freeglut\lib\x64\libfreeglut.a -DGLEXT_INCLUDE_DIR=\path\to\glext
182 Download and build waffle for MinGW.
183 http://www.waffle-gl.org/
185 Open the Command Prompt.
186 CD to piglit directory.
188 cmake -H. -Bbuild -G "Ninja" -DGLEXT_INCLUDE_DIR=\path\to\glext -DPIGLIT_USE_WAFFLE=TRUE -DWAFFLE_INCLUDE_DIRS=\path\to\waffle\include\waffle WAFFLE_LDFLAGS=\path\to\waffle\lib\libwaffle-1.a
194 Make sure that everything is set up correctly:
196 $ ./piglit run sanity results/sanity
198 You may include '.py' on the profile, or you may exclude it (sanity vs sanity.py),
199 both are equally valid.
201 You may also preface test profiles with tests/ (or any other path you like),
202 which may be useful for shell tab completion.
204 You may provide multiple profiles to be run at the same time:
206 $ ./piglit run quick_cl gpu deqp_gles3 results/gl-cl-combined
216 To learn more about the command's syntax.
218 Have a look into the tests/ directory to see what test profiles are available:
224 To create some nice formatted test summaries, run
226 $ ./piglit summary html summary/sanity results/sanity
228 Hint: You can combine multiple test results into a single summary.
229 During development, you can use this to watch for regressions:
231 $ ./piglit summary html summary/compare results/baseline results/current
233 You can combine as many testruns as you want this way (in theory;
234 the HTML layout becomes awkward when the number of testruns increases)
236 Have a look at the results with a browser:
238 $ xdg-open summary/sanity/index.html
240 The summary shows the 'status' of a test:
242 - **pass:** This test has completed successfully.
243 - **warn:** The test completed successfully, but something unexpected happened.
244 Look at the details for more information.
245 - **fail:** The test failed.
246 - **crash:** The test binary exited with a non-zero exit code.
247 - **skip:** The test was skipped.
248 - **timeout:** The test ran longer than its allotted time and was forcibly killed.
251 There are also dmesg-* statuses. These have the same meaning as above, but are
252 triggered by dmesg related messages.
255 ### 3.1 Environment Variables
257 There are a number of environment variables that control the way piglit
260 - `PIGLIT_COMPRESSION`
262 Overrides the compression method used. The same values that piglit.conf
263 allows for core:compression.
267 Overrides the platform run on. These allow the same values as `piglit run -p`.
268 This values is honored by the tests themselves, and can be used when running
271 - `PIGLIT_FORCE_GLSLPARSER_DESKTOP`
273 Force glslparser tests to be run with the desktop (non-gles) version of
274 glslparsertest. This can be used to test ESX_compatability extensions
277 - `PIGLIT_NO_FAST_SKIP`
279 Piglit has a mechanism run in the python layer for skipping tests with
280 unmet OpenGL or window system dependencies without starting a new
281 process (which is expensive). Sometimes this system doesn't work or is
282 undesirable, setting this environment variable to True will disable this
285 - `PIGLIT_NO_TIMEOUT`
287 When this variable is true in python then any timeouts given by tests
288 will be ignored, and they will run until completion or they are killed.
290 - `PIGLIT_VKRUNNER_BINARY`
292 Can be used to override the path to the vkrunner executable for
293 running Vulkan shader tests. Alternatively the config option
294 vkrunner:bin can be used instead. If neither are set then vkrunner
295 will be searched for in the search path.
300 The way `piglit run` and `piglit summary` count tests are different,
301 `piglit run` counts the number of Test derived instance in the profile(s)
302 selected, while `piglit summary` counts the number of subtests a result
303 contains, or it's result if there are no subtests. This means that the number
304 shown by `piglit run` will be less than or equal to the number calculated by
308 ### 3.3 Shell Completions
310 Piglit has completions for bash, located in completions/bash/piglit. Once this
311 file is sourced into bash `piglit` and `./piglit` will have tab completion
312 available. For global availability place the file somewhere that bash will
313 source the file on startup. If piglit is installed and bash-completions are
314 available, then this completion file will be installed system-wide.
317 4. Available test sets
318 ----------------------
320 Test sets are specified as Python scripts in the tests directory.
321 The following test sets are currently available:
326 - **sanity.py** This suite contains minimal OpenGL sanity tests. These tests
327 must pass, otherwise the other tests will not generate reliable results.
328 - **all.py** This suite contains all OpenGL tests.
329 - **quick.py** Run all tests, but cut down significantly on their runtime
330 (and thus on the number of problems they can find).
331 - **gpu.py** A further reduced set of tests from quick.py, this runs tests
332 only for hardware functionality and not tests for the software stack.
333 - **llvmpipe.py** A reduced set of tests from gpu.py removing tests that are
334 problematic using llvmpipe
335 - **cpu.py** This profile runs tests that don't touch the gpu, in other words
336 all of the tests in quick.py that are not run by gpu.py
337 - **glslparser.py** A subset of all.py which runs only glslparser tests
338 - **shader.py** A subset of all.py which runs only shader tests
339 - **no_error.py** A modified version of the test list run as khr_no_error
345 - **cl.py** This suite contains all OpenCL tests.
346 - **quick_cl.py** This runs all of the tests from cl.py as well as tests from
347 opencv and oclconform.
352 - **vulkan.py** This suite contains all Vulkan tests. Note that
353 currently all of the Vulkan tests require VkRunner. If it is not
354 installed then all of the tests will be skipped.
356 ### 4.4 External Integration
358 - **xts.py** Support for running the X Test Suite using piglit.
359 - **igt.py** Support for running Intel-gpu-tools test suite using piglit.
360 - **deqp_egl.py** Support for running dEQP's EGL profile with piglit.
361 - **deqp_gles2.py** Support for running dEQP's gles2 profile with piglit.
362 - **deqp_gles3.py** Support for running dEQP's gles3 profile with piglit.
363 - **deqp_gles31.py** Support for running dEQP's gles3.1 profile with piglit.
364 - **deqp_vk.py** Support for running the official Khronos Vulkan CTS profile
366 - **khr_gl.py** Support for running the open source Khronos OpenGL CTS tests
368 - **khr_gl45.py** Support for running the open source Khronos OpenGL 4.5 CTS
370 - **cts_gl.py** Support for running the closed source Khronos OpenGL CTS
372 - **cts_gl45.py** Support for running the closed source Khronos OpenGL 4.5
373 CTS tests with piglit.
374 - **cts_gles.py** Support for running the closed source Khronos GLES CTS
376 - **oglconform.py** Support for running sub-test of the Intel oglconform test
380 5. How to write tests
381 ---------------------
383 Every test is run as a separate process. This minimizes the impact that
384 severe bugs like memory corruption have on the testing process.
386 Therefore, tests can be implemented in an arbitrary standalone language.
387 C is the preferred language for compiled tests, piglit also supports its own
388 simple formats for test shaders and glsl parser input.
390 All new tests must be added to the appropriate profile, all.py profile for
391 OpenGL and cl.py for OpenCL. There are a few basic test classes supported by the
395 A shared base class for all native piglit tests.
397 It starts each test as a subprocess, captures stdout and stderr, and waits
398 for the test to return.
400 It provides test timeouts by setting the instances 'timeout' attribute to an
401 integer > 0 which is the number of seconds the test should run.
403 It interprets output by reading stdout and looking for 'PIGLIT: ' in the
404 output, and then reading any trailing characters as well formed json
405 returning the test result.
407 This is a base class and should not be used directly, but provides an
408 explanation of the behavior of the following classes.
411 A test class for native piglit OpenGL tests.
413 In addition to the properties of PiglitBaseTest it provides a mechanism for
414 detecting test window resizes and rerunning tests as well as keyword
415 arguments for platform requirements.
418 A test class for native piglit OpenCL tests.
420 It currently provides no special features.
423 A class for testing a glsl parser.
425 It is generally unnecessary to call this class directly as it uses a helper
426 function to search directories for tests.
429 A class for testing using OpenGL shaders.
431 It is generally unnecessary to call this class directly as it uses a helper
432 function to search directories for tests.
438 Piglit provides integration for other test suites as well. The rational for
439 this is that it provides piglit's one process per test protections (one test
440 crashing does not crash the whole suite), and access to piglit's reporting
443 Most integration is done through the use of piglit.conf, or through environment
444 variables, with piglit.conf being the preferred method.
449 Piglit provides a generic layer for dEQP based test suites, and specific
450 integration for several suites.
452 I suggest using Chad Versace's repo of dEQP, which contains a gbm target.
453 https://github.com/chadversary/deqp
455 It should be built as follows:
457 cmake . -DDEQP_TARGET=gbm -GNinja
459 Additional targets are available in the targets directory. gbm isn't compatible
460 for most (any?) blob driver, so another target might be necessary if that is a
461 requirement. One of the x11_* targets or drm is probably a good choice.
463 The use of ninja is optional.
465 Once dEQP is built add the following information to piglit.conf, which can
466 either be located in the root of the piglit repo, or in `$XDG_CONFIG_HOME`
467 (usually `$HOME/.config`).
470 bin=<deqp source dir>/modules/gles2/deqp-gles2
473 bin=<deqp source dir>/modules/gles3/deqp-gles3
476 bin=<deqp source dir>/modules/gles31/deqp-gles31
478 These platforms can be run using deqp_gles*.py as a suite in piglit.
481 ./piglit run deqp_gles31 my_results -c
483 It is also possible to mix integrated suites and piglit profiles together:
485 ./piglit run deqp_gles31 quick cl my_results
487 dEQP profiles generally contain all of the tests from the previous profile, so
488 gles31 covers gles3 and gles2.
493 Add the following to your piglit.conf file:
496 bin=<cts source dir>/cts/glcts