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, first make sure
92 you didn't have CMakeCache.txt file left from 64-bit build (it would retain old
93 flags), then you must invoke cmake with options "-DCMAKE_SYSTEM_PROCESSOR=x86
94 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32".
100 Install development packages.
101 $ 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
112 http://cmake.org/cmake/resources/software.html
113 Download and install 'Mac OSX Universal' platform.
116 http://developer.apple.com/xcode
124 glean will not build with MacOSX10.7.sdk. If you are trying to
125 build glean on Mac OS 10.7 (Lion), you will have to use MacOSX10.6.sdk.
127 Set 'CMAKE_OSX_SYSROOT' to '/Developer/SDKs/MacOSX10.6.sdk'. Configure.
135 Install development packages.
154 http://www.python.org/download
157 http://sourceforge.net/projects/numpy/files/NumPy
160 http://cmake.org/cmake/resources/software.html
161 Download and install 'Windows' platform.
163 Install Microsoft Visual Studio 2013 or later.
164 Install 'Visual C++' feature.
166 Download OpenGL Core API and Extension Header Files.
167 http://www.opengl.org/registry/#headers
168 Copy header files to MSVC.
169 C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL
172 http://www.pip-installer.org/en/latest/installing.html
175 > c:\Python27\Scripts\pip.exe install mako
181 Download freeglut for MSVC.
182 http://www.transmissionzero.co.uk/software/freeglut-devel
184 Open Visual Studio Command Prompt.
185 Start Menu->All Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt
186 CD to piglit directory.
189 > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .
192 - Use default native compilers
193 Set these variables in the Advanced view.
200 Build from the Visual Studio Command Prompt.
206 Download waffle for MSVC.
207 http://www.waffle-gl.org/
209 Open the Command Prompt.
210 CD to piglit directory.
213 > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .
215 - 'Visual Studio 12 2013', or
216 - 'Visual Studio 12 2013 Win64'
217 - Use default native compilers
218 Set these variables in the Advanced view.
219 Note that the values provided are for reference purposed and may differ on your system.
220 - PIGLIT_USE_WAFFLE, BOOL, TRUE
221 - WAFFLE_INCLUDE_DIRS, PATH, ${waffle_root}\include\waffle
222 - WAFFLE_LDFLAGS, FILEPATH, ${waffle_root}\lib\waffle-1.lib
223 - GLEXT_INCLUDE_DIR, PATH, C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL
228 Build from the Command Prompt.
234 Make sure that everything is set up correctly:
236 $ ./piglit run sanity results/sanity
238 You may include '.py' on the profile, or you may exclude it (sanity vs sanity.py),
239 both are equally valid.
241 You may also preface test profiles with tests/ (or any other path you like),
242 which may be useful for shell tab completion.
244 You may provide multiple profiles to be run at the same time:
246 $ ./piglit run quick_cl gpu deqp_gles3 results/gl-cl-combined
254 To learn more about the command's syntax.
256 Have a look into the tests/ directory to see what test profiles are available:
262 To create some nice formatted test summaries, run
264 $ ./piglit summary html summary/sanity results/sanity.results
266 Hint: You can combine multiple test results into a single summary.
267 During development, you can use this to watch for regressions:
269 $ ./piglit summary html summary/compare results/baseline.results results/current.results
271 You can combine as many testruns as you want this way (in theory;
272 the HTML layout becomes awkward when the number of testruns increases)
274 Have a look at the results with a browser:
276 $ xdg-open summary/sanity/index.html
278 The summary shows the 'status' of a test:
280 pass This test has completed successfully.
282 warn The test completed successfully, but something unexpected happened.
283 Look at the details for more information.
285 fail The test failed.
287 crash The test binary exited with a non-zero exit code
289 skip The test was skipped.
291 timeout The test ran longer than its allotted time and was forcibly killed.
294 There are also dmesg-* statuses. These have the same meaning as above, but are
295 triggered by dmesg related messages.
297 3.1 Environment Variables
298 -------------------------
300 There are a number of environment variables that control the way piglit
304 Overrides the compression method used. The same values that piglit.conf
305 allows for core:compression.
308 Overrides the platform run on. These allow the same values as ``piglit
309 run -p``. This values is honored by the tests themselves, and can be used
310 when running a single test.
312 PIGLIT_FORCE_GLSLPARSER_DESKTOP
313 Force glslparser tests to be run with the desktop (non-gles) version of
314 glslparsertest. This can be used to test ES<x>_COMPATABILITY extensions
318 Piglit has a mechanism run in the python layer for skipping tests with
319 unmet OpenGL or window system dependencies without starting a new
320 process (which is expensive). Sometimes this system doesn't work or is
321 undesirable, setting this environment variable to True will disable this
325 When this variable is true in python then any timeouts given by tests
326 will be ignored, and they will run until completion or they are killed.
331 The way 'piglit run' and 'piglit summary' count tests are different, 'piglit
332 run' counts the number of Test derived instance in the profile(s) selected,
333 while 'piglit summary' counts the number of subtests a result contains, or it's
334 result if there are no subtests. This means that the number shown by 'piglit
335 run' will be less than or equal to the number calculated by 'piglit summary'.
338 3.3 Shell Completions
339 ---------------------
341 Piglit has completions for bash, located in completions/bash/piglit. Once this
342 file is sourced into bash `piglit` and `./piglit` will have tab completion
343 available. For global availability place the file somewhere that bash will
344 source the file on startup. If piglit is installed and bash-completions are
345 available, then this completion file will be installed system-wide.
348 4. Available test sets
349 ----------------------
351 Test sets are specified as Python scripts in the tests directory.
352 The following test sets are currently available:
359 This suite contains minimal OpenGL sanity tests. These tests must
360 pass, otherwise the other tests will not generate reliable results.
363 This suite contains all OpenGL tests.
366 Run all tests, but cut down significantly on their runtime
367 (and thus on the number of problems they can find).
368 In particular, this runs Glean with the --quick option, which
369 reduces the number of visuals and state combinations tested.
372 A further reduced set of tests from quick.py, this runs tests only
373 for hardware functionality and not tests for the software stack.
376 A reduced set of tests from gpu.py removing tests that are problematic
380 This profile runs tests that don't touch the gpu, in other words all of
381 the tests in quick.py that are not run by gpu.py
384 A subset of all.py which runs only glslparser tests
387 A subset of all.py which runs only shader tests
394 This suite contains all OpenCL tests.
397 This runs all of the tests from cl.py as well as tests from opencv
401 4.3 External Integration
402 ------------------------
405 Support for running the X Test Suite using piglit.
408 Support for running Intel-gpu-tools test suite using piglit.
411 Support for running deQP's gles2 profile with piglit.
414 Support for running deQP's gles3 profile with piglit.
417 Support for running deQP's gles3.1 profile with piglit.
420 5. How to write tests
421 ---------------------
423 Every test is run as a separate process. This minimizes the impact that
424 severe bugs like memory corruption have on the testing process.
426 Therefore, tests can be implemented in an arbitrary standalone language.
427 C is the preferred language for compiled tests, piglit also supports its own
428 simple formats for test shaders and glsl parser input.
430 All new tests must be added to the appropriate profile, all.py profile for
431 OpenGL and cl.py for OpenCL. There are a few basic test classes supported by the
435 This is a test that is only used to integrate Glean tests
438 A shared base class for all native piglit tests.
440 It starts each test as a subprocess, captures stdout and stderr, and waits
441 for the test to return.
443 It provides test timeouts by setting the instances 'timeout' attribute to an
444 integer > 0 which is the number of seconds the test should run.
446 It interprets output by reading stdout and looking for 'PIGLIT: ' in the
447 output, and then reading any trailing characters as well formed json
448 returning the test result.
450 This is a base class and should not be used directly, but provides an
451 explanation of the behavior of the following classes.
454 A test class for native piglit OpenGL tests.
456 In addition to the properties of PiglitBaseTest it provides a mechanism for
457 detecting test window resizes and rerunning tests as well as keyword
458 arguments for platform requirements.
461 A test class for native piglit OpenCL tests.
463 It currently provides no special features.
466 A class for testing a glsl parser.
468 It is generally unnecessary to call this class directly as it uses a helper
469 function to search directories for tests.
472 A class for testing using OpenGL shaders.
474 It is generally unnecessary to call this class directly as it uses a helper
475 function to search directories for tests.
481 Piglit provides integration for other test suites as well. The rational for
482 this is that it provides piglit's one process per test protections (one test
483 crashing does not crash the whole suite), and access to piglit's reporting
486 Most integration is done through the use of piglit.conf, or through environment
487 variables, with piglit.conf being the preferred method.
493 Piglit provides a generic layer for dEQP based test suites, and specific
494 integration for several suites.
496 I suggest using Chad Versace's repo of dEQP, which contains a gbm target.
497 https://github.com/chadversary/deqp
499 It should be built as follows:
500 cmake . -DDEQP_TARGET=gbm -GNinja
502 Additional targets are available in the targets directory. gbm isn't compatible
503 for most (any?) blob driver, so another target might be necessary if that is a
504 requirement. One of the x11_* targets or drm is probably a good choice.
506 The use of ninja is optional.
508 Once dEQP is built add the following information to piglit.conf, which can
509 either be located in the root of the piglit repo, or in $XDG_CONFIG_HOME
510 (usually $HOME/.config).
514 bin=<deqp source dir>/modules/gles2/deqp-gles2
517 exe=<deqp source dir>/modules/gles3/deqp-gles3
520 bin=<deqp source dir>/modules/gles31/deqp-gles31
523 NOTE: for historical reasons gles3 uses 'exe' instead of 'bin'
525 These platforms can be run using deqp_gles*.py as a suite in piglit.
526 For example: ./piglit run deqp_gles31 my_results -c
528 It is also possible to mix integrated suites and piglit profiles together:
529 ./piglit run deqp_gles31 quick cl my_results
531 dEQP profiles generally contain all of the tests from the previous profile, so
532 gles31 covers gles3 and gles2.
538 Add the following to your piglit.conf file:
542 bin=<cts source dir>/cts/glcts