summaryrefslogtreecommitdiff
path: root/tests/oglconform.py
AgeCommit message (Collapse)AuthorFilesLines
2018-11-08python: add explicit utf-8 encodingEric Engestrom1-0/+1
I went with `# coding=utf-8` as it was the most common format in the existing code: 24 # coding=utf-8 21 ## coding=utf-8 19 # encoding=utf-8 9 ## encoding=utf-8 6 # -*- coding: utf-8 -*- I added it as the first line after the shebang, if any. Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2016-02-08framework,unittests: use __future__ unicode_literalsDylan Baker1-0/+3
Use unicode_literals from __future__. This makes undecorated strings (those not using and b or u prefix) into unicode instead of bytes in python 2. This means that bytes strings need to have a b prefix now. This also fixes a couple of unittests that broke during the transition. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
2015-10-29tests/oglconform.py: make interpret_result() faster in most casesDylan Baker1-6/+16
This optimizes the common paths of OGLCTest.interpret_result(): pass and the common skip case. For most OGLCTest cases the result will be in the final 3 lines of stdout. In this case it is substantially faster to split the last 3 lines, and then check for a string in that list than to use either an RegexObject (even a pre-compiled one) or to use a 'str in str' approach. I've used a script to benchmark the performance of each approach, using the actual output of a test. This assumes a single expression in the RegexObject (no use of 'or'). This script is in the mailing list archive for those curious, but I felt it was too long to leave in a commit message. The final approach is 10x faster than the 'str in str' approach, and 6.5x faster than the compiled re. While interpret_result doesn't constitute a huge amount of time in the piglit run, it does account for some of it, and this should at least shave a few seconds off the final run time. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: fix importsDylan Baker1-1/+2
Currently Test is imported from framework.profile and this happens to work. However, this isn't the correct place to get Test from, and it isn't guaranteed to continue working in the future. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: simplify writing to /dev/nullDylan Baker1-2/+2
I'm a little surprised this actually works in current form, since it's currently pointing to an int, rather than a file-like object. This patch simplifies the code by pointing at the open file-like object. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: Fix style issues indentified by pylintDylan Baker1-9/+9
Fixes the following warnings from pylint: - constants should be ALL_CAPS - shadowing names from the outer scope Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Vinson Lee <vlee@freedesktop.org>
2015-10-29tests/oglconform.py: minor refactor to simplify try/except blockDylan Baker1-3/+4
This moves code out of the try/except block that we don't mean to catch exceptions in, which is better coding practice. This also sets the except block to ValueError only, which is the error that will occur if there aren't enough values to unpack, which the except block was added to catch. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: override command.getterDylan Baker1-2/+6
This moves some constant arguments out of the permanently stored values in each test instance into a getter, which reduces the number of duplicate elements that need to be stored per instance. This reduces memory usage a little. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: Use tempfile module instead of hard-coded filenameDylan Baker1-9/+10
This is a nice cleanup, since it allows us to a) not have a hardcoded dependency of /tmp existing, b) it means that the temporary file is removed after it's used automatically, and c) it allows us to test the _make_profile function. I would really prefer not to refactor without tests, but refactoring is a requirement to test this function, so this needs to land before tests. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-29tests/oglconform.py: wrap profile creation in a functionDylan Baker1-15/+20
This makes generating the profile a cleaner affair, and enables testing it. It also pulls variables out of the global scope that don't belong in the global scope. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-27tests/oglconform.py: add super call to interpret_result()Dylan Baker1-0/+2
fix crash/warn handling. cc: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-10-20Fix oglconform integration.Kenneth Graunke1-5/+5
Everything reported 'fail' all the time because interpretResult() wasn't updated amdist all the Piglit framework rewriting. Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2015-05-19tests/oglconform.py: Use new error handling codeDylan Baker1-5/+4
This uses the new exceptions and new PiglitConfig methods. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-03-14oglconform.py: Fix PEP 8 issues.Vinson Lee1-9/+14
Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-12-12oglconform.py: Use grouptools instead of os.pathDylan Baker1-2/+2
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-10-14framework/test: refactor abstract Test and PiglitTestDylan Baker1-3/+2
This creates two separate modules for these classes. Making this change allows us to separate the basic building blocks of Test classes and the concrete implementations. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-10-14framework: Move tests derived classes into a packageDylan Baker1-1/+1
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-10oglconform.py: Use config file instead of symlinkDylan Baker1-2/+3
Instead of symlinking oglconform into the bin/ dir, edit piglit.conf and set the path key under the oglconform to the root of the oglconform dir. v2: - change config key 'bindir' to 'path' (chadv) Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-17framework: stop passing duplicate argumentsDylan Baker1-7/+6
A number of methods in Test require to have stdout, the returncode and the TestResult() instance passed into them. This is redundant since the TestResult() instance already has all of that information in it. Since a lot of methods need this information make the TestResult() an instance attribute. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-17framework: Split TestProfile and related out of coreDylan Baker1-1/+1
This solves a dependency loop between core and exectest, laying the groundwork for future improvements to the exectest module. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-10python: replace Test.interpretResult with Test.interpret_resultDylan Baker1-1/+1
From python's PEP8: "Function names should be lowercase, with words separated by underscores as necessary to improve readability." This patch was generated with the following shell command: find . -name '*py' | xargs sed -i -e 's!interpretResult!interpret_result!g' Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-10python: replace testBinDir with TEST_BIN_DIRDylan Baker1-2/+2
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-03exectest.py: Merge Test and ExecTest into a single classDylan Baker1-3/+4
Rather than have 2 base classes, let's just have one. v2: - remove test that no longer is valid v3: - fix igt using ExecTest instead of Test - fix Test setting two different run methods - fix piglit-print-commands.py, which also relied on ExecTest 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-02-04Use the new dmesg classDylan Baker1-3/+3
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-31Rename oglconfirm.py to oglconform.py.Kenneth Graunke1-0/+77
Botched in commit cdfbf724df8c01eb4d7723abe73985594dd46550.