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, Vulkan, and OpenCL
18 The goal of Piglit is to help improve the quality of open source
19 OpenGL, Vulkan, and OpenCL drivers by providing developers with a simple
20 means to 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:
33 - numpy (http://www.numpy.org)
34 - cmake (http://www.cmake.org)
35 - GL, glu and glut libraries and development packages (i.e. headers)
36 - waffle (http://waffle.freedesktop.org/)
38 Optionally, you can install the following:
40 - X11 libraries and development packages (i.e. headers)
41 - ninja. For a faster build.
42 - lxml. An accelerated python xml library using libxml2 (http://lxml.de/)
43 - jsonstreams. A JSON stream writer for python.
44 (https://jsonstreams.readthedocs.io/en/stable/)
45 - VkRunner. A shader script testing tool for Vulkan.
46 (https://gitlab.freedesktop.org/mesa/vkrunner/)
48 For testing the python framework using `py.test unittests/framework`
49 - py.test. A python test framework, used for running the python framework
51 - tox. A tool for testing python packages against multiple configurations of
52 python (https://tox.readthedocs.org/en/latest/index.html)
53 - psutil. A portable process library for python
54 - jsonschema. A JSON validator library for python
55 - pytest-mock. A mock plugin for pytest
56 - pytest-pythonpath. A plugin for pytest to do automagic with sys.path
57 - pytest-raises. A plugin for pytest that allows decorating tests that expect
59 - pytest-warnings. A plugin for pytest that handles python warnings
60 - pytest-timeout. A plugin for pytest to timeout tests.
62 Now configure the build system:
71 ### 2.1 Cross Compiling
73 On Linux, if cross-compiling a 32-bit build on a 64-bit host, first make sure
74 you didn't have CMakeCache.txt file left from 64-bit build (it would retain old
75 flags), then you must invoke cmake with options
76 `-DCMAKE_SYSTEM_PROCESSOR=x86 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32`.
81 Install development packages.
83 $ sudo apt-get install cmake g++ mesa-common-dev libgl1-mesa-dev python3-numpy python3-mako freeglut3-dev x11proto-gl-dev libxrender-dev libwaffle-dev libudev-dev
94 http://cmake.org/cmake/resources/software.html
95 Download and install 'Mac OSX Universal' platform.
98 http://developer.apple.com/xcode
108 Install development packages.
127 http://www.python.org/download
130 http://cmake.org/cmake/resources/software.html
131 Download and install 'Windows' platform.
133 Download and install Ninja
134 https://github.com/ninja-build/ninja/releases
137 https://mingw-w64.org/
139 Download OpenGL Core API and Extension Header Files.
140 https://github.com/KhronosGroup/OpenGL-Registry
141 Pass `-DGLEXT_INCLUDE_DIR=/path/to/headers`
154 Download freeglut for Mingw.
155 http://www.transmissionzero.co.uk/software/freeglut-devel/
157 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
163 Download and build waffle for MinGW.
164 https://gitlab.freedesktop.org/mesa/waffle
166 Open the Command Prompt.
167 CD to piglit directory.
169 cmake -H. -Bbuild -G "Ninja" -DGLEXT_INCLUDE_DIR=\path\to\glext -DPIGLIT_USE_WAFFLE=TRUE -DWaffle_INCLUDE_DIRS=\path\to\waffle\include\waffle -DWaffle_LDFLAGS=\path\to\waffle\lib\libwaffle-1.dll.a
172 ## 3. How to run tests
174 Make sure that everything is set up correctly:
176 $ ./piglit run sanity results/sanity
178 You may include '.py' on the profile, or you may exclude it (sanity vs sanity.py),
179 both are equally valid.
181 You may also preface test profiles with tests/ (or any other path you like),
182 which may be useful for shell tab completion.
184 You may provide multiple profiles to be run at the same time:
186 $ ./piglit run quick_cl gpu deqp_gles3 results/gl-cl-combined
196 To learn more about the command's syntax.
198 Have a look into the tests/ directory to see what test profiles are available:
204 To create some nice formatted test summaries, run
206 $ ./piglit summary html summary/sanity results/sanity
208 Hint: You can combine multiple test results into a single summary.
209 During development, you can use this to watch for regressions:
211 $ ./piglit summary html summary/compare results/baseline results/current
213 You can combine as many testruns as you want this way (in theory;
214 the HTML layout becomes awkward when the number of testruns increases)
216 Have a look at the results with a browser:
218 $ xdg-open summary/sanity/index.html
220 The summary shows the 'status' of a test:
222 - **pass:** This test has completed successfully.
223 - **warn:** The test completed successfully, but something unexpected happened.
224 Look at the details for more information.
225 - **fail:** The test failed.
226 - **crash:** The test binary exited with a non-zero exit code.
227 - **skip:** The test was skipped.
228 - **timeout:** The test ran longer than its allotted time and was forcibly killed.
231 There are also dmesg-* statuses. These have the same meaning as above, but are
232 triggered by dmesg related messages.
235 ### 3.1 Environment Variables
237 There are a number of environment variables that control the way piglit
240 - `PIGLIT_COMPRESSION`
242 Overrides the compression method used. The same values that piglit.conf
243 allows for core:compression.
247 Overrides the platform run on. These allow the same values as `piglit run -p`.
248 This values is honored by the tests themselves, and can be used when running
251 - `PIGLIT_FORCE_GLSLPARSER_DESKTOP`
253 Force glslparser tests to be run with the desktop (non-gles) version of
254 glslparsertest. This can be used to test ESX_compatability extensions
257 - `PIGLIT_NO_FAST_SKIP`
259 Piglit has a mechanism run in the python layer for skipping tests with
260 unmet OpenGL or window system dependencies without starting a new
261 process (which is expensive). Sometimes this system doesn't work or is
262 undesirable, setting this environment variable to True will disable this
265 - `PIGLIT_NO_TIMEOUT`
267 When this variable is true in python then any timeouts given by tests
268 will be ignored, and they will run until completion or they are killed.
270 - `PIGLIT_VKRUNNER_BINARY`
272 Can be used to override the path to the vkrunner executable for
273 running Vulkan shader tests. Alternatively the config option
274 vkrunner:bin can be used instead. If neither are set then vkrunner
275 will be searched for in the search path.
279 Used to define the directory with the tests and their executable files.
280 If the project is built out of source, this variable must be set for
281 piglit to run successfully.
286 The way `piglit run` and `piglit summary` count tests are different,
287 `piglit run` counts the number of Test derived instance in the profile(s)
288 selected, while `piglit summary` counts the number of subtests a result
289 contains, or it's result if there are no subtests. This means that the number
290 shown by `piglit run` will be less than or equal to the number calculated by
294 ### 3.3 Shell Completions
296 Piglit has completions for bash, located in completions/bash/piglit. Once this
297 file is sourced into bash `piglit` and `./piglit` will have tab completion
298 available. For global availability place the file somewhere that bash will
299 source the file on startup. If piglit is installed and bash-completions are
300 available, then this completion file will be installed system-wide.
303 ## 4. Available test sets
305 Test sets are specified as Python scripts in the tests directory.
306 The following test sets are currently available:
311 - **sanity.py** This suite contains minimal OpenGL sanity tests. These tests
312 must pass, otherwise the other tests will not generate reliable results.
313 - **all.py** This suite contains all OpenGL tests.
314 - **quick.py** Run all tests, but cut down significantly on their runtime
315 (and thus on the number of problems they can find).
316 - **gpu.py** A further reduced set of tests from quick.py, this runs tests
317 only for hardware functionality and not tests for the software stack.
318 - **llvmpipe.py** A reduced set of tests from gpu.py removing tests that are
319 problematic using llvmpipe
320 - **cpu.py** This profile runs tests that don't touch the gpu, in other words
321 all of the tests in quick.py that are not run by gpu.py
322 - **glslparser.py** A subset of all.py which runs only glslparser tests
323 - **shader.py** A subset of all.py which runs only shader tests
324 - **no_error.py** A modified version of the test list run as khr_no_error
330 - **cl.py** This suite contains all OpenCL tests.
331 - **quick_cl.py** This runs all of the tests from cl.py as well as tests from
332 opencv and oclconform.
337 - **vulkan.py** This suite contains all Vulkan tests. Note that
338 currently all of the Vulkan tests require VkRunner. If it is not
339 installed then all of the tests will be skipped.
344 - **replay.py** This profile allows running
345 [replayer.py](replayer/replayer.py) tests from a traces
346 description file. Check its [README](replayer/README.md) for
347 further information about the format of the description files and
348 running dependencies.
350 ### 4.5 External Integration
352 - **xts.py** Support for running the X Test Suite using piglit.
353 - **igt.py** Support for running Intel-gpu-tools test suite using piglit.
354 - **deqp_egl.py** Support for running dEQP's EGL profile with piglit.
355 - **deqp_gles2.py** Support for running dEQP's gles2 profile with piglit.
356 - **deqp_gles3.py** Support for running dEQP's gles3 profile with piglit.
357 - **deqp_gles31.py** Support for running dEQP's gles3.1 profile with piglit.
358 - **deqp_vk.py** Support for running the official Khronos Vulkan CTS profile
360 - **khr_gl.py** Support for running the open source Khronos OpenGL CTS tests
362 - **khr_gl45.py** Support for running the open source Khronos OpenGL 4.5 CTS
364 - **cts_gl.py** Support for running the closed source Khronos OpenGL CTS
366 - **cts_gl45.py** Support for running the closed source Khronos OpenGL 4.5
367 CTS tests with piglit.
368 - **cts_gles.py** Support for running the closed source Khronos GLES CTS
370 - **oglconform.py** Support for running sub-test of the Intel oglconform test
374 ## 5. How to write tests
376 Every test is run as a separate process. This minimizes the impact that
377 severe bugs like memory corruption have on the testing process.
379 Therefore, tests can be implemented in an arbitrary standalone language.
380 C is the preferred language for compiled tests, piglit also supports its own
381 simple formats for test shaders and glsl parser input.
383 All new tests must be added to the appropriate profile, all.py profile for
384 OpenGL and cl.py for OpenCL. There are a few basic test classes supported by the
388 A shared base class for all native piglit tests.
390 It starts each test as a subprocess, captures stdout and stderr, and waits
391 for the test to return.
393 It provides test timeouts by setting the instances 'timeout' attribute to an
394 integer > 0 which is the number of seconds the test should run.
396 It interprets output by reading stdout and looking for 'PIGLIT: ' in the
397 output, and then reading any trailing characters as well formed json
398 returning the test result.
400 This is a base class and should not be used directly, but provides an
401 explanation of the behavior of the following classes.
404 A test class for native piglit OpenGL tests.
406 In addition to the properties of PiglitBaseTest it provides a mechanism for
407 detecting test window resizes and rerunning tests as well as keyword
408 arguments for platform requirements.
411 A test class for native piglit OpenCL tests.
413 It currently provides no special features.
416 A class for testing a glsl parser.
418 It is generally unnecessary to call this class directly as it uses a helper
419 function to search directories for tests.
422 A class for testing using OpenGL shaders.
424 It is generally unnecessary to call this class directly as it uses a helper
425 function to search directories for tests.
429 See the [HACKING](HACKING) file.
433 Piglit provides integration for other test suites as well. The rational for
434 this is that it provides piglit's one process per test protections (one test
435 crashing does not crash the whole suite), and access to piglit's reporting
438 Most integration is done through the use of piglit.conf, or through environment
439 variables, with `piglit.conf` being the preferred method.
444 Piglit provides a generic layer for dEQP based test suites, and specific
445 integration for several suites.
447 Use the upstream dEQP repo (maintained by Khronos members), which
448 contains the official conformance tests (CTS):
449 https://github.com/KhronosGroup/VK-GL-CTS
451 Once dEQP is built add the following information to piglit.conf, which can
452 either be located in the root of the piglit repo, or in `$XDG_CONFIG_HOME`
453 (usually `$HOME/.config`).
456 bin=<deqp source dir>/modules/gles2/deqp-gles2
459 bin=<deqp source dir>/modules/gles3/deqp-gles3
462 bin=<deqp source dir>/modules/gles31/deqp-gles31
464 These platforms can be run using deqp_gles*.py as a suite in piglit.
467 ./piglit run deqp_gles31 my_results -c
469 It is also possible to mix integrated suites and piglit profiles together:
471 ./piglit run deqp_gles31 quick cl my_results
473 dEQP profiles generally contain all of the tests from the previous profile, so
474 gles31 covers gles3 and gles2.
479 Add the following to your piglit.conf file:
482 bin=<cts source dir>/cts/glcts