summaryrefslogtreecommitdiff
path: root/framework/shader_test.py
AgeCommit message (Collapse)AuthorFilesLines
2014-10-14framework: Move tests derived classes into a packageDylan Baker1-121/+0
This moves all of the classes that derive from Test into a package called test. This patch looks very large, but is mostly just moving files around and changing imports to account for this. So why all of this code churn? The big advantage is that through __init__.py magic there is one module to be imported, framework.test. This module contains all of the public classes, functions, and constants, in one place while hiding the rest, but allowing them to be accessed explicitly. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-07-16framework: fix duplicated TEST_BIN_DIR for cygwinBrian Paul1-4/+4
The GLSLParserTest and ShaderTest subclasses of the PiglitTest class were prepending the TEST_BIN_DIR variable onto the executable name (such as "glslparsertest" and "shader_runner"). But the PiglitTest class itself also does that so we were prepending TEST_BIN_DIR twice. With unix paths, os.path.join("/abs/path1", "/abs/path2") returns "/abs/path2". But with cygwin, os.path.join("C:\\abspath1", "C:\\abspath2") returns "C:\\abspath1/C:\\abspath2" which clearly causes trouble. The solution is to only prepend the TEST_BIN_DIR path in the PiglitTest class. This issue was only encountered when the PIGLIT_BUILD_DIR env var was set, which I just recently tried for the first time. v2: don't change GleanTest, it's a subclass of Test, not PiglitTest. Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-17framework: Replace Group() with dict()Dylan Baker1-2/+1
Group is a subclass of dict, with no overrides. This is silly and confusing, it's a dictionary, just use a dictionary. This has the additional advantage of removing a lot of spaghetti dependency issues, since nearly every module needed access to Group() Most of this was done with the shell command: find . -name '*py' | xargs sed -i -e 's!Group()!{}!g' Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-11framework: Fix concurrency regression introduced by Test refactorDylan Baker1-1/+2
For whatever reason the concurrency flag was not passed to GLSLParserTest and ShaderTest after the refactor. This patch fixes that by always passing that keyword argument as was done before. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-04-10python: replace testBinDir with TEST_BIN_DIRDylan Baker1-4/+4
From python's PEP8: "Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL." This patch generated with the following shell command: 'find . -name '*py' | xargs sed -i -e 's!testBinDir!TEST_BIN_DIR!g' Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-03python: Rename PlainExecTest to PiglitTestDylan Baker1-4/+4
Since PlainExecTest is either used directly or as a parent for running "native" piglit tests, it seems fitting to give it a name that reflects that purpose. This patch was mostly generated with the following command: find . -name '*.py' | xargs sed -i -e 's!PlainExecTest!PiglitTest!g Then a handful of related changes were made manually (These were mostly docstrings or framework unit tests related) Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-03framework: move testBinDir to exectestDylan Baker1-2/+2
This is mostly consumed by Test's children, so putting it in the same module makes sense. This should reduce the number of imports from core as well, since most consumers of testBinDir also make use of ExecTest or PlainExecTest. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-03framework/shader_test.py: simplify ShaderTestDylan Baker1-174/+70
This patch almost completely reworks ShaderTest. It was originally much more complicated than was necessary, this code should be much easier to work with, and removes some quirks. One of those was that ShaderTest inherited from PlainExecTest, but used ExecTest's __init__ method, which has implications for changing either of those classes. v2: - remove shader_test_tests. This only had an initializer test, and that no longer applies since ShaderTest is now a function v3: - Don't remove shader_test_tests - Keep ShaderTest as a class rather than function - make looping over test files more efficient - make errors more specific - make tests more precise Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-03framework/shader_test.py: Remove standalone capabilityDylan Baker1-68/+14
Shader_test has a bizarre capability to be run as a standalone script as well as be used as a module. This was probably useful when developing the original shader_test implementation, but at this point it's unused code just waiting to bit-rot adding needless complexity Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-03-12python: Convert from print statement to functionDylan Baker1-0/+1
One of the biggest changes between python2 and python3 is that print changed from a statement to a function. This change was backported to python2 in the __future__ module, and this patch makes that conversation to ease the transition from python2 to python3. v2: - Replace dict comprehension with dict(generator). This is for python 2.6 compatability Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
2014-02-04Use the new dmesg classDylan Baker1-1/+1
This actually makes use of the new dmesg class rather than the dmesg functions. It touches a lot of files, but almost all of these changes are code removal rather than code addition. v5: - Fix dmesg handling in resume Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v4)
2014-01-28framework/shader_test.py: use explicit relative importsDylan Baker1-2/+2
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-01-28framework/shader_test.py: remove unused importsDylan Baker1-5/+0
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-01-23Revert "framework: Add support for a test timeout"Dylan Baker1-1/+0
This reverts commit ab2eb660925e3680e868c5f469a4ef32e6dd9a59. This patch has a bad interaction with the locking in the json writing library, running concurrently with this patch enabled can cause json corruption that cannot easily be untangled, and even when it is is the result is of low trustworthiness. v2: - Add message explaining why this patch is to be reverted - fix framework/status.py docstring that was mangled after the revert Acked-by: Daniel Vetter <daniel@ffwll.ch> Reviewed-by: Kenneth Gruanke <kenneth@whitecape.org> Signed-off-by: Dylan Baker <baker.dylan.c@mgmail.com>
2014-01-15framework/shader_test.py: fix bug from commit 260f211dDylan Baker1-2/+2
This patch fixes a minor bug. An exception catch calls a function with a single leading underscore instead of two leading underscores. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2013-11-14framework: Add support for a test timeoutDaniel Vetter1-0/+1
i-g-t tests can take a long time, and for a bunch of reasons (bad tuning on disparate set of platforms, stuck in the kernel which often can be recovered by interrupting with a signal, ...) that sometimes extends to a good approximation of forever. Hence this adds a per-test timeout value and a bit of infrastructure to adjust the results. Test results adjusting is done after calling interpretResult so that we don't have to replicate this all over the place. This might need to be adjusted for the piglit-native subtest stuff, but otoh igt is a bit special with it's crazy long-running tests. So I think we can fix this once it's actually needed. The default timeout is None, so this is purely opt-in. Note on the implementation: SIG_ALARM doesn't exists on Windows and stackoverflow overwhelmingly recommended to go with this thread-based approach here. But only tested on my Linux box here. I've also timed quick.tests run a bit and the overhead due to the additional thread we launch seems to be in the wash. So I didn't opt to make the thread launching optional if there's no timeout limit. v2: Also add all the boilerplate needed to handle the new test status in summaries. For the color I've opted for two shades of light blue, they nicely stick out from the current selection. v3: Fix GLSLParserTest and ShaderTest. They both derive from PlainExecTest but only call the __init__ function of the Test baseclass. I haven't really figured why this is and also not really what command I should pass to PlainExecTest.__init__, so just replicated the init code for now. v4: Initialize timeout earlier for tests where we use the ENOENT handling to skip them. Fix up the out, err passing from the thread. Apparently my idea of how python closures work was completely misguided - like with a function call a closure captures a copy of of a reference pointing at the original object. So assinging anything to them won't have any effect outside of the lambda. Hence we need to jump through hoops and pass an array around. Nicer fix would be to create a class or something, but that seems like overkill. v5: Fixup the fraction setting in status.py Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com> Cc: Dylan Baker <baker.dylan.c@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-10-23Use simplejson if availableDylan Baker1-1/+4
simplejson is a native code version of the json module in python (the json module in core python implements the simplejson api), which means that simplejson can be used in place of the json module, but it performs much better. This patch attempts to load simplejson, and falls back to normal json if it fails. In the summary path on a single run of quick.tests, simplejson is about 3-4 seconds faster than json, ~7 seconds vs ~11 seconds. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2013-09-23Optionally capture dmesg changes for each test and report them in a summaryMarek Olšák1-3/+3
The Radeon driver writes GPU page faults to dmesg and we need to know which tests caused them. If there is any change in dmesg during a test run, the test result is changed as follows: * pass -> dmesg-warn * warn -> dmesg-warn * fail -> dmesg-fail Dmesg is captured before and after each test and the difference between the two is stored in the test summary. The piglit-run.py parameter which enables this behavior is --dmesg. It's also recommended to use -c0. v2: - address some of Dylan's remarks, mainly bug fixes - fix get_dmesg_diff Reviewed-by: Dylan Baken <baker.dylan.c@gmail.com>
2013-07-29shader_test.py: PEP8 complianceDylan Baker1-18/+29
v3: - revert some things that were falsely marked as failures by an older version of the pep8 tool Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-02-08framework/shader_test: Permit unicode pathsKenney Phillis1-1/+2
This fixes resume failures when paths are interpreted as unicode when the script expects ascii. [chadv]: Replace `if (!X and !Y) assert()` with `assert(X or Y)`. Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-30shader_runner.py: Update regex to detect new require section syntaxTom Gall1-4/+4
With commit dadf56dad25730556e36e9446aabfc80458cc12f the syntax for the [require] section in the shader test data files changed for GL ES. This patch, updates the shader_runner.py regex to also understand the new syntax since this code parses the [require] section of the shader test data file to determine which shader_runner binary to run. When dispatch is implemented for GLES all this can go away. v2: formatting, better description, no GLSL ES, GLSL detection. Signed-off-by: Tom Gall <tom.gall@linaro.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-09shader_runner.py: fix gles2 supportTom Gall1-3/+1
Fix shader_test.py so it uses shader_runner_gles2 when running a shader test with GL 2.0 es in the [required] section. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Signed-off-by: Tom Gall <tom.gall@linaro.org>
2012-12-12framework/shader_test: Assume the api is GL if no requirements are foundChad Versace1-7/+7
Commit 260f211 caused some shader tests to regress with the message: "Failed to find [require] block". This patch changes the python script that drives shader_runner to assume that the test's API is GL if no GL requirement is found in the test file. This behavior matches the behavior of the shader_runner executable, whose default requirements are GL >= 1.0 and GLSL >= 1.10. I tested this patch with a full Piglit run. The delta against master-ed3903c consists only of fixes. Reviewed-by: Tom Gall <tom.gall@linaro.org> Tested-by: Tom Gall <tom.gall@linaro.org> Reported-by: Ian Romanick <idr@freedesktop.org> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2012-12-11framework: Use shader_test.py to drive shader testsChad Versace1-1/+226
Add a new class to shader_test.py, ShaderTest. ShaderTest.run() parses the [require] block of the shader test to determine which shader_runner executable should be used to run the test. This is needed because GLES3 shader tests must be run by shader_runner_gles3 and the GL tests by shader_runner. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2012-12-11framework: New module shader_test.pyChad Versace1-0/+45
This patch is a small refactor. It moves add_shader_test_dir() from all.tests into a new module, shader_test.py. Follow-on commits will expand the role of the new module. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>