aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/decorators.py
AgeCommit message (Collapse)Author
2016-06-02classes/lib: Complete transition to python3Richard Purdie
This patch contains all the other misc pieces of the transition to python3 which didn't make sense to be broken into individual patches. (From OE-Core rev: fcd6b38bab8517d83e1ed48eef1bca9a9a190f57) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02classes/lib: Update to match python3 iter requirementsRichard Purdie
python3 standardises its use of iteration operations. Update the code to match the for python3 requires. (From OE-Core rev: 2476bdcbef591e951d11d57d53f1315848758571) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-15oeqa/decorators: Use wraps consistentlyRichard Purdie
We want the decorator to leave the function names of the test unchanged. Some decorators are already using wraps for this but not all. Fix this to be consistent allowing inspection of the test to give the wanted values. (From OE-Core rev: 9e4d60b29ff5667d23a89953ce7139b34c11d40b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-27oeqa/utils/decorators: fix missing keyword arguments on decoratorsPaul Eggleton
We need to handle keyword arguments here or sending a keyword argument to a decorated function that accepts keyword arguments will trigger an error. (This showed up when testcase decorators were added to the recipetool.RecipetoolTests.test_recipetool_appendsrcfiles_basic_subdir test). (From OE-Core rev: f787b688f2884ce3fa888b4041030538c7d2bf55) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01oeqa/utils/decorators: Append the testname without the full pathLeonardo Sandoval
When getting the failures/errors/skipped lists, include the unit test without the full path. This issue was found on this scenario | test_1_logrotate_setup (oeqa.runtime.logrotate.LogrotateTest) ... FAIL | test_2_logrotate (oeqa.runtime.logrotate.LogrotateTest) ... ok Where test_1_logrotate failed and test_2_logrotate should not have run because @skipUnlessPassed("test_1_logrotate_setup") def test_2_logrotate(self): (From OE-Core rev: 8715beff7b910209627da3726b18b7abf801b557) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01oeqa/decorators: Fixed a problem with decorator logs link.Lucian Musat
When not doing actual tests with testimage, like for example exporting tests, the link to the log file was still created although the actual log file was not existent. Fixed it by moving the link creation part into the run() method. (From OE-Core rev: 6950a5b1220d1ff81dae15195fe0d8e06977fec8) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-28oeqa/decorators: Add timestamp to decorator logs.Lucian Musat
To avoid logs being overwriten when running the automated tests multiple times, log files include timestamps in their names and a link is created to point to the latest one. (From OE-Core rev: 0aa6af4aec6f9773ec2aea929deb3a1ed049cbb9) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18oeqa/decorators: Added decorator to restart the DUT in case of test hang.Lucian Musat
Once the DUT is hanged during testing, currently all the following test cases have to wait for default timeout to exit. Using this decorator the user can choose a timeout at case by case basis and what happens when the timeout is reached by overwriting the self.target.restart method. [YOCTO #7853] (From OE-Core rev: ce9a7501ea29ddba61ef7c297223b3f7eca5a2a1) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06oeqa/decorators: Fixed a problem with tests having the same names.Lucian Musat
When two or more tests had the same name but different classes then the decorator log whould have the output all wrong. This was because a comparison which was made only between method names but now it compares classes too. [YOCTO #8029] (From OE-Core rev: 2b475f82d13b5c04d0c483d11a7df5e9352caa75) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-04testimage: filter proper test cases by tagszjh
If a test case is decorate by oeqa.utils.decorators.tag, this case will by add a tag, testrunner will filter these tags by TEST_SUITES_TAGS [YOCTO #7849] (From OE-Core rev: 085589b1018ba4d950baf7bcfb499be02c1b29fc) Signed-off-by: zjh <junhuix.zhang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-11oeqa/utils: Added timeout decorator for testcases.Lucian Musat
(From OE-Core rev: c6fe26ade5734efb5250e00c56fdbb4095b0018b) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-21oeqa/utils/decorators: Fix up frame selectionNathan Rossi
Use threading to get the current threads ident to select the current executing frame to ensure that the scanned stack is the expected stack. This allows for the decorators to be used within a process that has multiple threads executing. (From OE-Core rev: a44d27b92baba4ab51f432ec01cdc473436ce406) Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-10testimage: sort modules based on dependenciesPatrick Ohly
TEST_SUITES="auto" is useful to run all suitable tests without having to hard-code the list. However, it did not take test dependencies into account, which can be an issue for tests which really depend on some other test to run first. To fix this, modules get loaded in the order determined by TESTS_SUITES, but then get re-ordered based on dependencies derived from @skipUnlessPassed before running them. The original order is used to break ties when there are no dependencies, so reordering only occurs when really necessary. @skipUnlessPassed gets extended such that it makes the test name a method depends on available for inspection by the test loader in oetest.py. Unfortunately Python's unittest offers no API to inspect tests in a TestSuite, so the code has to rely on implementation details to find all tests. The worst that can happen when the implementation changes is that tests are not found and reordering does not happen. (From OE-Core rev: 6e4543a35836c572b23b9f8162b19d1e038d3ed2) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-23oeqa/utils/decorators: Try and improve ugly _ErrorHandler tracebacksRichard Purdie
Currently, if one module is skipped, any other module calling skipModule causes tracebacks about _ErrorHandler not having a _testMethodName method. This reworks the code in a way to avoid some of the problems by using the id() method of the objects. It also maps to the correct name format rather than "setupModule" or just skiping the item entirely. (From OE-Core rev: 78d3bf2e4c88779df32b9dfbe8362dc24e9ad080) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-25oeqa/utils: fix testcase decorator to allow calling tests individuallyPaul Eggleton
Without this, running tests individually failed with a traceback: $ oe-selftest --run-test buildoptions.ImageOptionsTests.test_incremental_image_generation 2014-12-23 14:40:37,636 - selftest - INFO - Checking that everything is in order before running the tests 2014-12-23 14:40:38,408 - selftest - INFO - Running bitbake -p 2014-12-23 14:40:40,235 - selftest - INFO - Loading tests from: oeqa.selftest.buildoptions.ImageOptionsTests.test_incremental_image_generation Traceback (most recent call last): File "/home/user/poky/scripts/oe-selftest", line 179, in <module> ret = main() File "/home/user/poky/scripts/oe-selftest", line 164, in main suite.addTests(loader.loadTestsFromName(test)) File "/usr/lib64/python2.7/unittest/loader.py", line 91, in loadTestsFromName module = __import__('.'.join(parts_copy)) File "/home/user/poky/meta/lib/oeqa/selftest/buildoptions.py", line 12, in <module> class ImageOptionsTests(oeSelfTest): File "/home/user/poky/meta/lib/oeqa/selftest/buildoptions.py", line 14, in ImageOptionsTests @testcase(761) NameError: global name 'func' is not defined (From OE-Core rev: 8e3fbb0bb2c0eabfb39752c25e7c3f5d77881f64) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-25oeqa/utils: replace some tabs with spacesPaul Eggleton
Python code should use spaces only for indentation. (From OE-Core rev: a1e22121e521aabf454a850cd7c8be60b7b1adc3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-29oeqa/utils: Added filter to LogResults decorator to enforce custom log level.Lucian Musat
(From OE-Core rev: 65c97d4abd26f38917cd89b5f50f7299221b2123) Signed-off-by: Lucian Musat <georgex.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-02oeqa/utils/decorators.py: add import osCorneliu Stoicescu
An 'import os' was omitted here while testing the previous decorators using runtime tests that import the os module before this one. Unfortunately oe-selftest fails because of this missing import. (From OE-Core rev: 5381e6cf6bf7143074800b2949bfa5331fdb6d47) Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25oeqa: Refactor test skipping decorators to use the unittest result objectLucian Musat
In order to make the test skipping decorators independent of the oeTest object we rely on the unittest result object to construct skip, fail and error lists used by these decorators. Created a new object getResults that analyses upper frames and retrieves the unittest result object instance, then return a list of failed, skipped and error tests. Also removed the oetest import from decorators.py because it was no longer required. (From OE-Core rev: 4d2d201158236bd4c72546cf8db88681ff921b11) Signed-off-by: Lucian Musat <georgex.l.musat@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-03Added testcase decorator to use in logging. Added class decorator LogResults ↵Lucian Musat
that outputs test results in separate log file. (From OE-Core rev: 7e2b73f1ccfe2968ef780fef2edfaa31c3dae853) Signed-off-by: Lucian Musat <georgex.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-05lib/oeqa: add oeTest superclassStefan Stanacar
Add oeTest superclass, make oeRuntimeTest inherit that and make the necesarry adjustments. Tests in lib/oeqa/runtime don't change, they still inherit oeRuntimeTest. We should do this because oetest.py in the future can be a base module for more stuff than oeRuntimeTest. (From OE-Core rev: cd4ed41a070bd52c446ac3df8337f17ab9421145) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-26lib/oeqa/utils: decorators: return the decorated methodMihai Lindner
Decorators should return whatever the decorated methods return. (From OE-Core rev: c92513d6ff3f8f06d937a5cdf4d94708f27c3850) Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-16lib/oeqa: fix dependecy checkStefan Stanacar
Adds missing skip for smart test and fix the check (which I somehow broke a while ago). (From OE-Core rev: cf1790d992f067be8d5f9894458f55f6f1bdc61f) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-16testimage.bbclass, lib/oeqa: add headers and commentsStefan Stanacar
Adds some comments to testimage.bbclass and the files it calls, just to give an ideea of what it does. (From OE-Core rev: 8bbb7116cf02466dfc59a17dc7bb51287aeea55b) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-09lib/oeqa/utils/decorators.py: decorators for test methodsRadu Moisan
Some skip decorators meant only for test methods, providing some kind of test methods dependency. They are used together with a test method name not a condition. These are complementary to python's unittest skip decorators. (From OE-Core rev: 79cb89648702aa80ec986e0026c62948de905b87) Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>