summaryrefslogtreecommitdiff
path: root/framework/core.py
AgeCommit message (Collapse)AuthorFilesLines
2017-07-11wgl: initial check-in of wgl utility code and wgl sanity check programBrian Paul1-1/+1
Like the glx tests/utility code, but for wgl. Note, one must set the PIGLIT_PLATFORM env var to "wgl" before running Piglit. It looks like there's some Waffle work to look at before this can be made automatic.
2016-06-01framework/core.py: add module docstringDylan Baker1-0/+7
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01framework/core.py: Make copyright header match others in the frameworkDylan Baker1-23/+19
The copyright notice was slightly different than most of the framework, (mostly things like "author(s)" vs "authors or copyright holders"), and the line length was different. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01framework/core: extend check_dir to take a handler callableDylan Baker1-4/+14
This allows check_dir to fulfill the needs of the overwrite switch in the main run function. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01core.py: add docstring to check_dirDylan Baker1-1/+17
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01core.py: make second argument to check_dir a keyword argumentDylan Baker1-1/+1
This allows callers that don't want to fail to leave the keyword out. It doesn't affect those that set it to true. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01framework: rename core.checkDir to core.check_dirDylan Baker1-1/+1
This is the PEP8 proper format for the name, and since piglit tries to conform to PEP8 as practical it makes sense to rename this. It is pretty much the non-PEP8 named function in piglit. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01framework: core.checkDir raises PiglitExceptionDylan Baker1-3/+1
This requires each caller that sets failifexists=True to handle the error, but it allows them to set a custom message or handle the failure themselves, rather than just bailing. This makes the function more generically useful, and removes a layering violation. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01core.py: use PiglitFatalError instead of sys.exitDylan Baker1-4/+3
This is cleaner and more in keeping with the style of piglit. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01core.py: only call makedirs if the directory doesn't existDylan Baker1-1/+2
This isn't exactly idiomatic, but makedirs can be *very slow*, especially if the path is long and exists completely. By checking before creating, and recovering from expected errors this function can be fast and safe. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-06-01core.py: remove flag from checkDir, use exception blockDylan Baker1-8/+4
This simplifies the function.
2016-06-01core.py: use 'in list' instead of a == b or a == c...Dylan Baker1-1/+1
This is cleaner and idiomatic. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Vinson Lee <vlee@freedesktop.org>
2016-04-16framework: Fix spelling mistakesEric Engestrom1-1/+1
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2016-02-08framework/core.py: make collect_system_info return unicodeDylan Baker1-2/+2
This changes collect_system_info to convert the raw output of each command to unicode before returning it. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-02-08framework,unittests: use __future__ unicode_literalsDylan Baker1-1/+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>
2016-02-08framework: use six.moves.configparserDylan Baker1-7/+8
This module is a compatibility shim for python 3.x and 2.x Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-02-08python: use future print, division, and absolute_importDylan Baker1-1/+1
These are the three python3 like behaviors that piglit should rely on. The only other applicable future import is unicode_literals. Although my plan is to use unicode_literals, that will actually cause behavioral changes in some cases, where these cause minimal changes to the code. Piglit will not be targeting < 3.2, they are old, unsupported, and have fewer features than 2.7. Piglit now has division (using / as floating division, and // as integer division), print as a function (rather than a statement), and absolute import, which changes the way import works when there's a conflict between a local import and a system wide one. Absolute import makes more sense, and copies the behavior of python 3 Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
2015-11-25framework/core.py: add -nn to lspciDylan Baker1-1/+1
This adds extra information to determine the intel gt slice. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2015-11-11framework: Convert the codebase to use the new global OptionsDylan Baker1-50/+0
This is the plunge to change over from the old options model to the new one. After this change Options is a global value, and no more passing or creation of new instances is done (except for testing). Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-09-30framework: add clinfo to system informationDylan Baker1-0/+1
It's like glxinfo or wglinfo, but for OpenCL. Reviewed-by: Serge Martin <edb+piglit@sigluy.net> Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-09-23framework/core: add fallback to PiglitConfig.safe_getDylan Baker1-3/+3
This is in keeping with the way that configparser.get() works in python3 (although there are some corner case differences since in python3 it uses keyword only arguments, which don't exist in python2). Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Thomas Wood <thomas.wood@intel.com>
2015-09-22framework/summary.py: Add a class to summary for calculating categoriesDylan Baker1-0/+21
This class lazily evaluates regressions, problems, etc; and caches the results. This generates a set or list of sets containing the names of the tests, and a count of the number of tests. This also adds a new decorator, the lazy_property. This is a very clever Descriptor class, that adds the calculated value to the instance (while the descriptor itself belongs to the class) under the same name, thus shadowing itself. This means that the calculation of the Descriptor is done once, and then stored, making any method decorated with this class lazy. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-08-03core.py: use errno instead of int for error checkingDylan Baker1-2/+3
This makes the code a little cleaner and easier to read. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-07-16Revert "framework: remove last use of core.checkDir"Dylan Baker1-0/+23
This reverts commit 992bbcec39c335892c2c618fe3923a6a0ce6ffa4.
2015-07-16framework: remove last use of core.checkDirDylan Baker1-23/+0
With the previous change there is only one user of checkDir, which was in need of refactor if it was going to be generally useful. So instead, just remove it, the replacement is less code and it's obvious what it does. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-05-19framework/core.py: Add a custom PiglitConfig classDylan Baker1-2/+54
This allows us to encapsulate a lot of the error handling logic into a single place with easy to use methods. This should reduce the amount of code in consumers of PIGLIT_CONFIG. It adds two new methods, safe_get and required_get, which operate on NoOptionError or NoSectionError. With safe_get, if either of these is raised None will be return, for required_get a PiglitFatalError will be raised. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-03-16framework/core.py: Fix PEP 8 issues.Vinson Lee1-2/+6
Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2015-02-24profile_tests.py: Fix -x and -i with lowercased namesDylan Baker1-2/+4
As of ea381355a0625a1 all test names were stored lowercase. The reasons for this are outlined in that commit message, and while the summary was updated to correctly handle these changes the -x and -i options to piglit run were not. This patch fixes the problem by altering the regex created from the values passed to be case insensitive. It also adds a testcast to the nost tests to demonstrate the fix. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Mark Janes <mark.a.janes@intel.com>
2014-12-24framework: Cleanup importsDylan Baker1-2/+1
Makes 2 changes, all of which should have absolutely zero effect 1) breaks the imports into three newline separated groups: builtins, installed modules, local modules 2) use print_function and absolute_import in all modules. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-10-14framework: Move PLATFORMS list to coreDylan Baker1-4/+8
This allows the PLATFORMS list to be readily shared, and will be used in the next patch. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-09-25framework: refactor the log moduleDylan Baker1-4/+2
This refactors the log module away from a single class that does everything to having two classes. The first class LogFactory, is a state manager that returns BaseLog derived objects when it's get() method is called. However, it mainly acts as a shared state manager. The BaseLog derived classes provide three public methods; start(), log(), summary(). This makes the interfaces much cleaner, just 3 public methods that are fairly obvious and clearly documented. It uses inheritance for more shared code, and is just generally much less complex than the previous implementation The use of a non-recursive lock mandates that the majority of the code be in un-locked protected methods, while the public method takes the lock, otherwise inheritance is nearly impossible. v2: - Fix summary line in the verbose logger to support using '\r'. This works by printing the summary at the end of start() and log() - add -v/--verbose option back (Ilia) v3: - Be more aggressive about locking v4: - be more granular with locking by using two locks, one for printing, one for manipulating the shared data. - Move some unit tests to the next patch that belong there. v5: - simplify the locking. This may have a performance impact, but makes the code much simpler. It should be possible to make the locking finer grained later v6: - Lock one additional command v7: - fix bug in Test. Test did not call log.start() so verbose log would print <status>: None - replace RLock with Lock. This requires a little bit of refactoring to make it work, since the lock cannot be called recursively v8: - remove trailing whitespace Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-09-23core.py: don't overwrite user's PIGLIT_SOURCE_DIR env varBrian Paul1-4/+3
When creating an Options object, use the environment's PIGLIT_SOURCE_DIR value when available. Fixes spec/ARB_ES3_compatibility/oes_compressed_etc2_texture-miptree test failures in Cywin. Also, remove the MESA_DEBUG=silent setting. Piglit shouldn't care if debug output is on/off (we stopped looking for Mesa error messages a long time ago). v2: simplify code with dict get() method and default value. Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-08-26core.py: Fix bug in get_configDylan Baker1-1/+1
A bug was introduced in 9e0c3ee1, this fixes it. Because the get_config needs to find the piglit root, it has a hard coded path to look for <current file>/../.. which worked when it was in framework/programs/run.py, but in the mentioned commit the function was moved to framework/core.py, a level down, so the hard coded path no longer worked. This patch removes a '..', so the function now searches for the right depth. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2014-08-20programs/run.py add file sync command line optionMatt Atwood1-1/+2
Currently while running igt tests a kernel panic causes the results json file to lose all data. This patch adds a command line option (-s, --sync) that syncs the file descriptor to disk after every test allowing data to persist through hard crashes. v2: Call flush() before fsync(), explicitly pass fileno instead of fd v3: sync write_dict_key added v4: git log maintenance v5: - Fix one unit test for JSONWriter, the constructor signature changed (Dylan) Reviewed-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-08-20core: Initialize ConfigParser with allow_no_value=TrueTom Stellard1-1/+1
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-08-18core.py: Remove warning about piglit.confDylan Baker1-6/+1
This warning annoys some people, and it isn't strictly necessary, so I guess it should go. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-07-17framework: move get_config() to coreThomas Wood1-0/+23
Move framework.programs.run._get_config() to framework.core.get_config() so that it can be used elsewhere. v2: set a default value for the get_config argument and fix function call in integration_tests.py (Dylan Baker) Signed-off-by: Thomas Wood <thomas.wood@intel.com> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-06-24core.py: Add additional catch to collect_system_info()Dylan Baker1-0/+4
Catch subprocess.CalledProcessError, which is an exception that subprocess.check_call() raises if the binary returns a non 0 status. The usual culprit for this is glxinfo on systems not running X Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
2014-06-23framework: Split code out of framework.coreDylan Baker1-286/+0
This splits results code out of core into its own module. This makes the code cleaner and easier to understand, and is groundwork for coming patches. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-06-23core.py: rename Environment to OptionsDylan Baker1-2/+15
Environment doesn't really describe what the class is (although, honestly it's a pretty bad class design), but Options comes much closer to what it is. v7: - update piglit-print-commands.py - replace instance name 'env' with 'opts' - rename Test.ENV to Test.OPTS Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-06-23core.py: Simplify Environment constructorDylan Baker1-13/+2
This replaces assignment followed by for loops with list comprehensions. This is less code, simpler, and faster. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-06-23core: replace Environment.collectData()Dylan Baker1-22/+27
Environment.collectData() is strange and awful for a host of reasons. 1) Its implementation was such that it should have been a static method, but it wasn't 2) It wasn't at all related to Environment 3) It used a public helper which it was the sole consumer of. Replacing it with a top level function makes a lot more sense for all of these reason. This function has another major advantage, it assumes nothing. In the former implementation it was assumed that specific operating systems had specific tools available, and that those tools were only available on that platform. This implementation doesn't assume that, instead it makes a blind leap that the tools is available, and then is caught if its wrong. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-06-23framework: Don't rely on os.environ so muchDylan Baker1-15/+8
There are some problems with using os.environ, all of which are caused shell child-variable relationships. Most of these problems are easy to solve, since we don't actually need to have environment variables set except during test execution, and that can be passed to Popen (or it's helper wrappers). This gives us much better assurance that things are happening in the way we expect. v7: - use itertools.chain instead of nested iterations - fix piglit.conf default case - reorder environment overrides so that variables passed in by the user (or exported) override the builtin values instead of vice-versa Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-24framework/core.py: Remove unused imports and fix __all__Dylan Baker1-8/+4
After profile was split out of the core module it's imports were not removed. This has a small overhead cost and drive the code quality checking tools crazy. __all__ is a module name that controls the values exported when running help() or pydoc. Setting these to reflect proper values helps python tools to function better and makes the documentation accurate. None of these changes affect running code at all. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-23framework: Dump the result of 'uname -a' in the reportDamien Lespiau1-0/+3
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2014-04-21framework: fix potential bug in function signaturesDylan Baker1-4/+5
There is a potential for some very odd bugs because of the way python handles mutable arguments. Consider this: def foo(defaults=[]): defaults.append('a') return defaults Calling foo(['bar']) will do the expected thing: >>> foo(['bar']) ['bar', 'a'] But calling foo() will not: >>> foo() ['a'] >>> foo() ['a', 'a'] 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-181/+0
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-17framework: Replace Group() with dict()Dylan Baker1-10/+5
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-10python: replace Test argument runConcurrent with run_concurrentDylan Baker1-2/+2
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!runConcurrent!run_concurrent!g' Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-03framework: move testBinDir to exectestDylan Baker1-8/+1
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>