summaryrefslogtreecommitdiff
path: root/framework
AgeCommit message (Collapse)AuthorFilesLines
2011-08-12Fix Python 2.6 incompatibility in str.decode() function.Paul Berry1-2/+2
In Python 2.6, the str.decode() function can't take keyword arguments, so x.decode(y, errors=z) must be changed to x.decode(y, z). There is no difference in functionality. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40051
2011-08-11Fix import_glsl_parser_tests' dependency on the number of dirs in basepath.Paul Berry1-5/+6
To figure out where a test file belongs in the test hierarchy, import_glsl_parser_tests has to determine the test file's path relative to the "basepath" argument. Before this patch, it worked out the relative path by dropping the first three directories from the test file's path. This worked because import_glsl_parser_tests was always called with a basepath that contained exactly three directory names, e.g. "./spec/glsl-1.00". But it was a fragile assumption. This patch changes import_glsl_parser_tests so that it uses os.path.relpath() to work out the relative path. I've also taken the liberty of fixing a typo in the docstring explaining how basebath is used, and I've changed "assert(type(testname) is str)" to "assert isinstance(testname, basestring)", which works properly with Unicode. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-11Fix JSON problems with non-ASCII characters, by explicitly decoding test output.Paul Berry1-0/+17
Due to a design flaw in Python 2.x, if an 8-bit string containing a non-ASCII character is ever used in a context requiring a unicode string, the Python interpreter will raise an exception. This happens because Python lazily decodes 8-bit strings to unicode as needed, and when it does the decoding it assumes the 8-bit string is in ASCII format. Because of this lazy decoding behavior, this means that 8-bit strings containing non-ASCII characters are unsafe in any Python program that also uses unicode. Since Python 3.x doesn't have 8-bit strings (it has "byte arrays", which don't autoconvert to unicode strings), the most forward-compatible way to address this problem is to find the source of the unsafe 8-bit strings, and introduce an explicit decoding step that translates them to unicode strings and handles errors properly. This problem manifested in Piglit if the output of a test ever contained a non-ASCII character. Due to Python 2.x's lazy string decoding semantics, the exception wouldn't occur until attempting to serialize the test output as JSON. This patch introduces an explicit step, right after running a test, which decodes the test output from 8-bit strings into unicode. The decoding assumes UTF-8, and silently replaces invalid UTF-8 sequences with the unicode "replacement character" rather than raise an exception.
2011-07-29Refactor PlainExecTest, GleanTest, and GTFTest to share code.Kenneth Graunke2-80/+61
Each of these classes are essentially the same, except for: 1. How to determine whether the test passed/failed 2. Setting up the command and options All the logic for running the command and obtaining its output can be shared, as well as the logic to determine if it trapped/aborted/etc. This patch creates a new 'ExecTest' base class. Subclasses can set the exact command to run and options in their __init__ method, and must supply an 'interpretResult' method which reads the output and sets results['result'] to pass/fail (along with other desired annotations). v2: Update for JSON related changes and ensure that output stays the same. (Piglit and Glean are identical; GTF now includes the command that was run but is otherwise equivalent.) Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-07-29Remove @@@ from return code in Glean and GTF tests.Kenneth Graunke1-1/+1
This is no longer necessary thanks to the JSON rework. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-07-29piglit-run: Add option to enable/disable concurrent test runsChad Versace1-1/+2
-c bool, --concurrent=bool Enable/disable concurrent test runs. Valid option values are: 0, 1, on, off. (default: on) CC: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Chad Versace <chad@chad-versace.us> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-07-29framework: Repair result file if result file is incomplete or corruptChad Versace1-0/+68
If the JSON result file was not closed properly, perhaps due a system crash during a test run, then TestrunResult.parseFile will attempt to repair the file before parsing it. The repair is performed on a string buffer, and the result file is never written to. This allows the result file to be safely read during a test run. CC: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-07-29core: Add method TestrunResult.__checkFileIsNotInOldFormatChad Versace1-8/+14
Factor out from TestrunResult.parseFile the code that checks if the file is in the old format. Place that code into a separate method, __checkFileIsNotInOldFormat. CC: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-07-29framework: Write each test result to the result file as the test completesChad Versace1-9/+12
When a test run is interrupted, perhaps by a system crash, we often want the test results. To accomplish this, Piglit must write each test result to the result file as the test completes. If the test run is interrupted, the result file will be corrupt. This is corrected in a subsequent commit. CC: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-07-29framework: Add class JSONWriterChad Versace1-0/+126
JSONWriter writes to a JSON file stream. It will be used by a subsequent commit to write each test result to the result file as the test completes. CC: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-07-17Tweak gitignore.José Fonseca1-1/+0
2011-07-14framework: Raise informative error when parsing a result file in old formatChad Versace1-1/+16
If TestrunResult.parseFile is passed a file in the old, pre-json format, then raise ResultFileInOldFormatError. Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-07-14framework: Replace custom serialization format with jsonChad Versace3-198/+120
The results file produced by piglit-run.py contains a serialized TestrunResult, and the serialization format was horridly homebrew. This commit replaces that insanity with json. Benefits: - Net loss of 113 lines of code (ignoring comments and empty lines). - By using the json module in the Python standard library, serializing and unserializing is nearly as simple as `json.dump(object, file)` and `json.load(object, file)`. - By using a format that is easy to manipulate, it is now simple to extend Piglit to allow users to embed custom data into the results file. As a side effect, the summary file is no longer needed, so it is no longer produced. Reviewed-by: Paul Berry <stereotype441@gmail.com> Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-06-20glsl_parser_test: Make [end_config] synonymous with [end config]Chad Versace1-1/+1
Because we shouldn't penalize anyone for using the underscore as a separator. Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-05-23framework: decode arrays when parsing test run resultsPaul Berry1-1/+1
When reading in test run results we were mistakenly not decoding escape sequences inside arrays. This resulted in occasional extra backslashes in lists such as "errors" and "errors_ignored". Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-04-21core: Add Windows EXCEPTION_INT_DIVIDE_BY_ZERO exceptions to crashes.Vinson Lee2-2/+10
2011-04-21core: Use forward slash as separator for GLSL group names.Vinson Lee1-2/+1
The rest of piglit assumes that forward slash is the separator for the group name. This patch fixes the summary HTML results on Windows. Tests are now properly displayed in subgroups instead of the entire group name listed as part of the test name.
2011-04-15core: Add POSIX SIGFPE arithmetic exceptions as crashes.Vinson Lee2-2/+2
2011-04-11core: Add Windows access violations as crash results.Vinson Lee2-0/+8
2011-04-06core: Include bus errors in crash category.Vinson Lee2-2/+2
2011-04-06core: generate a summary of fixesMarek Olšák1-0/+4
Same as regressions if you reverse the order of columns.
2011-04-06core: generate a summary of regressionsMarek Olšák1-3/+18
This is basically a subset of 'changes'. The regression is if a test result changes from either 'pass' or 'skip' to something other than 'pass' and 'skip'. Thus the relation is: { pass, skip } -> { warn, fail, trap, abort, crash } Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-06core: add new status trap, abort, and crash printed as black lines in summaryMarek Olšák3-8/+30
To distiguish between 'fail' and unexpected termination. Acked-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Chad Versace <chad.versace@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-06core: print the real command with arguments in the test reportMarek Olšák2-0/+7
Acked-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Chad Versace <chad.versace@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2011-03-12all.tests: Blacklist some shader tests that cause memory explosionsChad Versace1-0/+14
Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-03-12framework: Support running Piglit with an out-of-tree buildChad Versace1-1/+4
To run Piglit with an out-of-tree build, set the environment variable PIGLIT_BUILD_DIR. For example: $ env PIGLIT_BUILD_DIR=/path/to/piglit/build/dir \ ./piglit-run.py tests/sanity.tests results/sanity.results Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-02-17Replace poolName in Test constructor with boolean option.U. Artie Eoff2-8/+13
Replaced poolName in the Test constructor with runConcurrent boolean option. runConcurrent defaults to False. When True, the Test pushes its doRunWork to the ConcurrentTestPool to be executed in another thread. When False, doRunWork is executed immediately on the calling thread (main thread). Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-02-17Remove ThreadPoolsU. Artie Eoff1-38/+0
Remove ThreadPools from threads module since it is no longer needed/used. ConcurrentTestPool is now the only threadpool needed to manage cpu-only tests. Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-02-17Move gpu tests to main thread and cpu-only tests to threadpool.U. Artie Eoff1-5/+6
This is an intermediate change that moves the "base" (or gpu) tests to the main thread and the other (cpu-only) tests to the ConcurrentTestPool threads. This restores ctrl-c behavior for gpu tests. Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-02-17Add ConcurrentTestPool singleton.U. Artie Eoff1-0/+16
The ConcurrentTestPool singleton will simplify the threading model and remove the need to manage multiple ThreadPools. Only one threadpool is currently needed at this time and is meant to execute cpu-only tests in separate threads. Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-02-10glsl_parser_test: Add test instances to thread pool 'gpu-not-used'Chad Versace1-2/+2
2011-02-10Respond to KeyboardInterrupt exception.U. Artie Eoff1-2/+7
Respond to KeyboardInterrupt exception so that execution can clean up and write a summary file before shutting down.
2011-02-10Add SyncFileWriter for write/close synchronization on results file.U. Artie Eoff1-6/+5
Add SyncFileWriter class to synchronize writes to the 'main' results file from multiple threads. This helps to ensure that writes to this file are not intermingled.
2011-02-10Modify the Test class in core.py to use ThreadPools.U. Artie Eoff1-2/+10
Modify Test class to use ThreadPools in its doRun method. All tests now execute in the default ThreadPool named 'base'. A Test instance can be configured to run in a different (named) ThreadPool instance by setting its poolName member variable to that name.
2011-02-10Add synchronization to Logger functions.U. Artie Eoff1-0/+3
Add synchronization decorator to Logger functions for multithreaded logging support.
2011-02-10Add threads.pyU. Artie Eoff1-0/+75
Add threads.py which defines a synchronization decorator that will be used for multithreaded synchronized access to critical sections. Also defines a ThreadPools singleton that manages named ThreadPool instances. A ThreadPool instance named 'base' is created by default with one worker thread. New uniquely named ThreadPool instances can be created with a configurable number of worker threads.
2011-02-10Add threadpool.pyU. Artie Eoff1-0/+418
Add threadpool.py to support future concurrency support.
2011-02-07Added a simple logging class. Updated Test::doRun to use the new log.U. Artie Eoff3-3/+140
Added log.py which includes a simple Logger class that wraps some basic functions from the Python logging module. The log wrapper simplifies setup and will accommodate thread synchronization in the future. Test::doRun now uses the new log facility. NOTE: this changes the format of the 'test progress' previously printed via stdout. Added patterns.py which includes a Singleton class design pattern to support the Logger class. Future design patterns can be added to this file. Tested with Python 2.7 on Linux. All should be compatible with Windows and Mac and most earlier widely-used versions of Python. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-01-27Revert "glsl_parser_test: Add config opt 'override_extensions'"Chad Versace1-8/+4
This reverts commit 3fd587bcd8efa12baa65ef59f7ac527199b31f12. The email that precipitated the revert: On 01/27/2011 11:52 AM, Ian Romanick wrote: I don't understand why it is useful / necessary to have this in the test. If you're trying to test driver features while they're being implemented, you can / should do this by hand. If you're not trying to test driver features while they're being implemented, you don't any this to happen behind your back.
2011-01-25glsl_parser_test: Add config opt 'override_extensions'Chad Versace1-4/+8
The option manually enables or disables extensions via the environment variable MESA_EXTENSION_OVERRIDE.
2011-01-25glsl_parser_test: Rename config opt 'extension' to 'require_extensions'Chad Versace1-4/+4
... and update all test file using the option. The new name makes clear what the option does.
2011-01-25glsl_parser_test: Rewrite GLSLParserTestChad Versace1-106/+116
Replace functional, stateless style with more traditional stateful style. This does not alter the public behavior of GLSLParserTest nor Piglit test results. Storytime: When I initially wrote GLSLParserTest, I attempted to use a functional style in which the class maintained a minimal amount of state. Now that I have a need to modify the class, I realize how unsuited the stateless style is to Python. I atone for my function sins :)
2011-01-20modified TestResults::write() for thread safetyU. Artie Eoff1-6/+9
made TestResults::write() thread-safe by writing results in one chunk to the file so that when threaded tests are implemented there will be no interleaving. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-01-12glsl_parser_test.py: Document import_glsl_parser_tests()Chad Versace1-3/+14
2011-01-12glsl_parser_test.py: Fix minor typoChad Versace1-1/+1
2011-01-07glslparsertest: Allow tests to require GL extensionsIan Romanick1-2/+7
2011-01-07Use import_glsl_parser_tests instead of open coding itIan Romanick1-2/+2
2011-01-07framework: Add utility function to import a directory tree of GLSL parser testsIan Romanick1-0/+22
2010-12-01framework: Add class GLSLParserTestChad Versace2-29/+370
This test class feeds a GLSL source file to the glslparsertest executable. Information about the test (such as expected result and GL requirments) may be placed directly in the shader source file as a specially formatted comment block. Also, modify PlainExecTest to skip tests for which 'command == None'. This prevents glslparsertests that lack a config section from failing in odd ways.
2010-10-07gleantest: Store the command as a member variable.Vinson Lee1-4/+6
Store the command during object creation but append the global parameters, which can be changed, at runtime.