7 3. [How to run tests](#3-how-to-run-tests)
8 4. [Available test sets](#4-available-test-sets)
9 5. [How to write tests](#5-how-to-write-tests)
10 6. [Integration](#6-integration)
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/ )
29 First of all, you need to make sure that the following are installed:
31 - Python 2.7.x or >=3.5
33 - numpy (http://www.numpy.org)
34 - six (https://pypi.python.org/pypi/six)
35 - cmake (http://www.cmake.org)
36 - GL, glu and glut libraries and development packages (i.e. headers)
37 - X11 libraries and development packages (i.e. headers)
38 - waffle (http://www.waffle-gl.org)
41 Optionally, you can install the following:
43 - lxml. An accelerated python xml library using libxml2 (http://lxml.de/)
44 - simplejson. A fast C based implementation of the python json library.
45 (https://simplejson.readthedocs.org/en/latest/)
46 - jsonstreams. A JSON stream writer for python.
47 (https://jsonstreams.readthedocs.io/en/stable/)
48 - VkRunner. A shader script testing tool for Vulkan.
49 (https://github.com/igalia/vkrunner)
51 For Python 2.x you can install the following to add features, these are
52 unnecessary for python3:
53 - backports.lzma. A backport of python3's lzma module to python2,
54 this enables fast native xz (de)compression in piglit for results files
55 (https://github.com/peterjc/backports.lzma)
56 - subprocess32. A backport of the subprocess from python3.2, which includes
57 timeout support. This only works for Linux
59 For testing the python framework using `py.test unittests/framework`
60 - py.test. A python test framework, used for running the python framework
62 - tox. A tool for testing python packages against multiple configurations of
63 python (https://tox.readthedocs.org/en/latest/index.html)
64 - mock. A python module for mocking other python modules. Required only for
65 unittests (https://github.com/testing-cabal/mock)
66 - psutil. A portable process library for python
67 - jsonschema. A JSON validator library for python
68 - pytest-mock. A mock plugin for pytest
69 - pytest-pythonpath. A plugin for pytest to do automagic with sys.path
70 - pytest-raises. A plugin for pytest that allows decorating tests that expect
72 - pytest-warnings. A plugin for pytest that handles python warnings
73 - pytest-timeout. A plugin for pytest to timeout tests.
75 Now configure the build system:
79 This will start cmake's configuration tool, just follow the onscreen
80 instructions. The default settings should be fine, but I recommend you:
81 - Press 'c' once (this will also check for dependencies) and then
82 - Set `CMAKE_BUILD_TYPE` to `Debug` Now you can press 'c' again and then 'g' to generate the build system.
88 ### 2.1 Cross Compiling
90 On Linux, if cross-compiling a 32-bit build on a 64-bit host, first make sure
91 you didn't have CMakeCache.txt file left from 64-bit build (it would retain old
92 flags), then you must invoke cmake with options
93 `-DCMAKE_SYSTEM_PROCESSOR=x86 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32`.
98 Install development packages.
100 $ 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
111 http://cmake.org/cmake/resources/software.html
112 Download and install 'Mac OSX Universal' platform.
115 http://developer.apple.com/xcode
125 Install development packages.
144 http://www.python.org/download
147 http://cmake.org/cmake/resources/software.html
148 Download and install 'Windows' platform.
150 Download and install Ninja
151 https://github.com/ninja-build/ninja/releases
154 https://mingw-w64.org/
156 Download OpenGL Core API and Extension Header Files.
157 http://www.opengl.org/registry/#headers
158 Pass `-DGLEXT_INCLUDE_DIR=/path/to/headers`
171 Download freeglut for Mingw.
172 http://www.transmissionzero.co.uk/software/freeglut-devel/
174 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
180 Download and build waffle for MinGW.
181 http://www.waffle-gl.org/
183 Open the Command Prompt.
184 CD to piglit directory.
186 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
189 ## 3. How to run tests
191 Make sure that everything is set up correctly:
193 $ ./piglit run sanity results/sanity
195 You may include '.py' on the profile, or you may exclude it (sanity vs sanity.py),
196 both are equally valid.
198 You may also preface test profiles with tests/ (or any other path you like),
199 which may be useful for shell tab completion.
201 You may provide multiple profiles to be run at the same time:
203 $ ./piglit run quick_cl gpu deqp_gles3 results/gl-cl-combined
213 To learn more about the command's syntax.
215 Have a look into the tests/ directory to see what test profiles are available:
221 To create some nice formatted test summaries, run
223 $ ./piglit summary html summary/sanity results/sanity
225 Hint: You can combine multiple test results into a single summary.
226 During development, you can use this to watch for regressions:
228 $ ./piglit summary html summary/compare results/baseline results/current
230 You can combine as many testruns as you want this way (in theory;
231 the HTML layout becomes awkward when the number of testruns increases)
233 Have a look at the results with a browser:
235 $ xdg-open summary/sanity/index.html
237 The summary shows the 'status' of a test:
239 - **pass:** This test has completed successfully.
240 - **warn:** The test completed successfully, but something unexpected happened.
241 Look at the details for more information.
242 - **fail:** The test failed.
243 - **crash:** The test binary exited with a non-zero exit code.
244 - **skip:** The test was skipped.
245 - **timeout:** The test ran longer than its allotted time and was forcibly killed.
248 There are also dmesg-* statuses. These have the same meaning as above, but are
249 triggered by dmesg related messages.
252 ### 3.1 Environment Variables
254 There are a number of environment variables that control the way piglit
257 - `PIGLIT_COMPRESSION`
259 Overrides the compression method used. The same values that piglit.conf
260 allows for core:compression.
264 Overrides the platform run on. These allow the same values as `piglit run -p`.
265 This values is honored by the tests themselves, and can be used when running
268 - `PIGLIT_FORCE_GLSLPARSER_DESKTOP`
270 Force glslparser tests to be run with the desktop (non-gles) version of
271 glslparsertest. This can be used to test ESX_compatability extensions
274 - `PIGLIT_NO_FAST_SKIP`
276 Piglit has a mechanism run in the python layer for skipping tests with
277 unmet OpenGL or window system dependencies without starting a new
278 process (which is expensive). Sometimes this system doesn't work or is
279 undesirable, setting this environment variable to True will disable this
282 - `PIGLIT_NO_TIMEOUT`
284 When this variable is true in python then any timeouts given by tests
285 will be ignored, and they will run until completion or they are killed.
287 - `PIGLIT_VKRUNNER_BINARY`
289 Can be used to override the path to the vkrunner executable for
290 running Vulkan shader tests. Alternatively the config option
291 vkrunner:bin can be used instead. If neither are set then vkrunner
292 will be searched for in the search path.
297 The way `piglit run` and `piglit summary` count tests are different,
298 `piglit run` counts the number of Test derived instance in the profile(s)
299 selected, while `piglit summary` counts the number of subtests a result
300 contains, or it's result if there are no subtests. This means that the number
301 shown by `piglit run` will be less than or equal to the number calculated by
305 ### 3.3 Shell Completions
307 Piglit has completions for bash, located in completions/bash/piglit. Once this
308 file is sourced into bash `piglit` and `./piglit` will have tab completion
309 available. For global availability place the file somewhere that bash will
310 source the file on startup. If piglit is installed and bash-completions are
311 available, then this completion file will be installed system-wide.
314 ## 4. Available test sets
316 Test sets are specified as Python scripts in the tests directory.
317 The following test sets are currently available:
322 - **sanity.py** This suite contains minimal OpenGL sanity tests. These tests
323 must pass, otherwise the other tests will not generate reliable results.
324 - **all.py** This suite contains all OpenGL tests.
325 - **quick.py** Run all tests, but cut down significantly on their runtime
326 (and thus on the number of problems they can find).
327 - **gpu.py** A further reduced set of tests from quick.py, this runs tests
328 only for hardware functionality and not tests for the software stack.
329 - **llvmpipe.py** A reduced set of tests from gpu.py removing tests that are
330 problematic using llvmpipe
331 - **cpu.py** This profile runs tests that don't touch the gpu, in other words
332 all of the tests in quick.py that are not run by gpu.py
333 - **glslparser.py** A subset of all.py which runs only glslparser tests
334 - **shader.py** A subset of all.py which runs only shader tests
335 - **no_error.py** A modified version of the test list run as khr_no_error
341 - **cl.py** This suite contains all OpenCL tests.
342 - **quick_cl.py** This runs all of the tests from cl.py as well as tests from
343 opencv and oclconform.
348 - **vulkan.py** This suite contains all Vulkan tests. Note that
349 currently all of the Vulkan tests require VkRunner. If it is not
350 installed then all of the tests will be skipped.
352 ### 4.4 External Integration
354 - **xts.py** Support for running the X Test Suite using piglit.
355 - **igt.py** Support for running Intel-gpu-tools test suite using piglit.
356 - **deqp_egl.py** Support for running dEQP's EGL profile with piglit.
357 - **deqp_gles2.py** Support for running dEQP's gles2 profile with piglit.
358 - **deqp_gles3.py** Support for running dEQP's gles3 profile with piglit.
359 - **deqp_gles31.py** Support for running dEQP's gles3.1 profile with piglit.
360 - **deqp_vk.py** Support for running the official Khronos Vulkan CTS profile
362 - **khr_gl.py** Support for running the open source Khronos OpenGL CTS tests
364 - **khr_gl45.py** Support for running the open source Khronos OpenGL 4.5 CTS
366 - **cts_gl.py** Support for running the closed source Khronos OpenGL CTS
368 - **cts_gl45.py** Support for running the closed source Khronos OpenGL 4.5
369 CTS tests with piglit.
370 - **cts_gles.py** Support for running the closed source Khronos GLES CTS
372 - **oglconform.py** Support for running sub-test of the Intel oglconform test
376 ## 5. How to write tests
378 Every test is run as a separate process. This minimizes the impact that
379 severe bugs like memory corruption have on the testing process.
381 Therefore, tests can be implemented in an arbitrary standalone language.
382 C is the preferred language for compiled tests, piglit also supports its own
383 simple formats for test shaders and glsl parser input.
385 All new tests must be added to the appropriate profile, all.py profile for
386 OpenGL and cl.py for OpenCL. There are a few basic test classes supported by the
390 A shared base class for all native piglit tests.
392 It starts each test as a subprocess, captures stdout and stderr, and waits
393 for the test to return.
395 It provides test timeouts by setting the instances 'timeout' attribute to an
396 integer > 0 which is the number of seconds the test should run.
398 It interprets output by reading stdout and looking for 'PIGLIT: ' in the
399 output, and then reading any trailing characters as well formed json
400 returning the test result.
402 This is a base class and should not be used directly, but provides an
403 explanation of the behavior of the following classes.
406 A test class for native piglit OpenGL tests.
408 In addition to the properties of PiglitBaseTest it provides a mechanism for
409 detecting test window resizes and rerunning tests as well as keyword
410 arguments for platform requirements.
413 A test class for native piglit OpenCL tests.
415 It currently provides no special features.
418 A class for testing a glsl parser.
420 It is generally unnecessary to call this class directly as it uses a helper
421 function to search directories for tests.
424 A class for testing using OpenGL shaders.
426 It is generally unnecessary to call this class directly as it uses a helper
427 function to search directories for tests.
432 Piglit provides integration for other test suites as well. The rational for
433 this is that it provides piglit's one process per test protections (one test
434 crashing does not crash the whole suite), and access to piglit's reporting
437 Most integration is done through the use of piglit.conf, or through environment
438 variables, with piglit.conf being the preferred method.
443 Piglit provides a generic layer for dEQP based test suites, and specific
444 integration for several suites.
446 I suggest using Chad Versace's repo of dEQP, which contains a gbm target.
447 https://github.com/chadversary/deqp
449 It should be built as follows:
451 cmake . -DDEQP_TARGET=gbm -GNinja
453 Additional targets are available in the targets directory. gbm isn't compatible
454 for most (any?) blob driver, so another target might be necessary if that is a
455 requirement. One of the x11_* targets or drm is probably a good choice.
457 The use of ninja is optional.
459 Once dEQP is built add the following information to piglit.conf, which can
460 either be located in the root of the piglit repo, or in `$XDG_CONFIG_HOME`
461 (usually `$HOME/.config`).
464 bin=<deqp source dir>/modules/gles2/deqp-gles2
467 bin=<deqp source dir>/modules/gles3/deqp-gles3
470 bin=<deqp source dir>/modules/gles31/deqp-gles31
472 These platforms can be run using deqp_gles*.py as a suite in piglit.
475 ./piglit run deqp_gles31 my_results -c
477 It is also possible to mix integrated suites and piglit profiles together:
479 ./piglit run deqp_gles31 quick cl my_results
481 dEQP profiles generally contain all of the tests from the previous profile, so
482 gles31 covers gles3 and gles2.
487 Add the following to your piglit.conf file:
490 bin=<cts source dir>/cts/glcts