summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/context.py
AgeCommit message (Collapse)Author
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23oeqa/context: Only set buffer mode for non-concurrent testsRichard Purdie
Periodically we'd see: NOTE: core-image-sato-1.0-r0 do_testsdk: ====================================================================== NOTE: core-image-sato-1.0-r0 do_testsdk: ERROR: broken-runner NOTE: core-image-sato-1.0-r0 do_testsdk: ---------------------------------------------------------------------- NOTE: core-image-sato-1.0-r0 do_testsdk: testtools.testresult.real._StringException: Traceback (most recent call last): File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/meta/lib/oeqa/core/utils/concurrencytest.py", line 122, in _run_test test.run(process_result) File "/usr/lib/python3.6/site-packages/subunit/__init__.py", line 1194, in run protocol = TestProtocolServer(result, self._passthrough, self._forward) File "/usr/lib/python3.6/site-packages/subunit/__init__.py", line 514, in __init__ stream = stream.buffer AttributeError: '_io.StringIO' object has no attribute 'buffer' which seems to occur if a result arrives before all the runner threads have started. The runner's result handling changes sys.stdout to a buffer temporarily which can be seen in other threads and it can sometimes fail. Since the tests are running in a separate process we don't need this buffer handling in the concurrent case so only set when not parallelising. The concurrent class handle setting buffer mode internally. (From OE-Core rev: e2c66aa0f74d19fbc7e56af1fb440ad6473d3a8e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-18oeqa/runner: Simplify codeRichard Purdie
There doesn't appear to be any reason we need this _results indirection any more so remove it. (From OE-Core rev: b618261811c48ff3b98eab1b340a8cd09ef183c6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-18oeqa: Add selftest parallelisation supportRichard Purdie
This allows oe-selftest to take a -j option which specifies how much test parallelisation to use. Currently this is "module" based with each module being split and run in a separate build directory. Further splitting could be done but this seems a good compromise between test setup and parallelism. You need python-testtools and python-subunit installed to use this but only when the -j option is specified. See notes posted to the openedmbedded-architecture list for more details about the design choices here. Some of this functionality may make more sense in the oeqa core ultimately. (From OE-Core rev: 326ababfd620ae5ea29bf486b9d68ba3d60cad30) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16oeqa: Default to buffer mode for testsRichard Purdie
Currently some tests run in buffer mode and some don't. Those that don't can corrupt stdout/stderr. Switch to using buffer mode everywhere so we're consistent. If there is useful output on stdout/stderr, it will be displayed if the test fails. (From OE-Core rev: 978548c0abde2cb94c2782538552f39bdf2bf630) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-13context: Include a command line argument to run all except certain testsLeonardo Sandoval
A new command line argument (-R, which is the oposite of current -r) that allows to run all test cases except the ones indicated through the command line. Some command line examples: * Run all except the distro test case: $ oe-selftest -R distrodata * Run all except the archiver test case and a single bblayers unit test $ oe-selftest -R archiver bblayers.BitbakeLayers.test_bitbakelayers_add_remove [YOCTO #11847] (From OE-Core rev: e40eeaa790b95d9c25832405c0b0d5b3a0d0292b) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30oeqa/{core,selftest}: Add support to validate if a specified test case isn't ↵Aníbal Limón
found If some test module/case is specified to run and isn't found the OEQA framework didn't notice it, so complete the implementation using modules_required and validate for the test case prescense. Raise an exception when the test module/case required isn't found. [YOCTO #11645] (From OE-Core rev: e50b415aaaa1581473f85f0a8afa278b5f95129b) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-09oeqa: Change the order to logDetails and logSummaryAníbal Limón
Is better to log the summary at end to see in an easy way the actual result of the test run. [YOCTO #11622] (From OE-Core rev: 4e3ab36e8c90abc740cce1ba31faf6595116e1e2) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-06scripts/oe-test: Move load_test_components to oeqa.utilsAníbal Limón
In order to maintain compatibility with oe-selftest, the load_test_components needs to be re-used, so the script executor needs to pass to only load components supported by certain script (oe-test, oe-selftest). (From OE-Core rev: d6b78ae711b93b4059690320cb8d821aaadd1684) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core/context: Include a _pre_run methodLeonardo Sandoval
This pre runner will serve to allow Test components executes code previously of the run a suite. (From OE-Core rev: bafb7e221d40d7a87a02cec8a97d98eec7c23438) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core/context: Omit docstring output on XMLResultLeonardo Sandoval
By default, the xml runner class prints out the docstring for every unit test but it order to keep the same format as the standard runner, avoid docstring output setting descriptions to False. (From OE-Core rev: 05b16219698fbd30ec76697e1b3be6d31e8f8878) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core/context: Use a default iterable modules objectLeonardo Sandoval
The OETestLoader.modules must be an iterable object, otherwise checking presence of specific modules with the 'in' operator fails with the following command/error: % oe-test core .. - core - INFO - Running bitbake -p Traceback (most recent call last): File "..poky2/scripts/oe-test", line 108, in <module> ret = main() File "..poky2/scripts/oe-test", line 93, in main results = args.func(logger, args) File "..poky2/meta/lib/oeqa/core/context.py", line 235, in run self.tc.loadTests(self.module_paths, **self.tc_kwargs['load']) File "..poky2/meta/lib/oeqa/core/context.py", line 53, in loadTests self.suites = self.loader.discover() File "..poky2/meta/lib/oeqa/core/loader.py", line 204, in discover pattern='*.py', top_level_dir=path) File "/usr/lib64/python3.4/unittest/loader.py", line 275, in discover tests = list(self._find_tests(start_dir, pattern)) File "/usr/lib64/python3.4/unittest/loader.py", line 339, in _find_tests yield self.loadTestsFromModule(module) File "..poky2/meta/lib/oeqa/core/loader.py", line 266, in loadTestsFromModule and module.__name__ in self.modules \ TypeError: argument of type 'NoneType' is not iterable (From OE-Core rev: 2bb02cd3d6ec6c2c22ab6b567e2985015655fae6) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core/context: Raise exception when a manifest is specified but missingLeonardo Sandoval
(From OE-Core rev: e7458dd24cb7464852fb7f5357d9108d5c052fa6) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core: Add support for run tests by module, class and nameAníbal Limón
This will enable only run certain module tests and filter by class and test name. (From OE-Core rev: 0f7531803aa6ffef2b7c5be9acee3efe7d2974ef) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core: Add list tests support in context and runnerAníbal Limón
A common operation is to list tests, currently only selftest support it, this changes enables this functionality into the core framework. (From OE-Core rev: 7e803f1a855d3091a772b13efd3cc8e9c0c766e9) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core: Move OETestContext.log{Summary, Details} into OETestResultAníbal Limón
Those methods are used to write in the log the results so it makes sense to have defined at OETestResult because is a format of the result itself. [YOCTO #11450] (From OE-Core rev: 33a783f59ed4e232f41f8b09dfa7955f2ddc2f80) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02oeqa/core: Don't expose OEStreamLogger in OETestContextAníbal Limón
The OEStreamLogger class is used for redirect PyUnit output to a certain logger so there is not need to expose at level of OETestContext because only OETestRunner needs to know. [YOCTO #11450] (From OE-Core rev: 8787fba3df8acd9d2438669d20b1a5060caa9022) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31oeqa/core/context.py: Add validation for run-tests optionAníbal Limón
The run-tests option is optional so if isn't specified set to None instead of crash on split(). (From OE-Core rev: 877732406cad2ee4bf11293dc8ccddc2998ffbaf) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23oeqa/core/context: Add option to select tests to runMariano Lopez
This add the option to select what tests to run in the <module>[.<class>[.<test>]] format. Currently it just support modules (From OE-Core rev: 0050565d71cee5a0cc22660b2398e4334d4b6719) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23oeqa/core/context: Add support of OETestContextExecutorAníbal Limón
The OETestContextExecutor class supports to use oe-test for run core test component also is a base class for the other test components (runtime, sdk, selftest). Te principal functionality is to support cmdline parsing and execution of OETestContext, the test components could extend the common options to provide specific ones. The common options between test components are test data file, output log and test cases path's to scan. Also it initializes the logger to be passed to the whole OEQA framework. [YOCTO #10230] (From OE-Core rev: 039deafa5f2c8fab31b8373b39f8bc219377b893) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23oeqa/core: Add loader, context and decorator modulesAníbal Limón
loader: Implements OETestLoader handling OETestDecorator and filtering support when load tests. The OETestLoader is responsible to set custom methods, attrs of the OEQA frameowork. [YOCTO #10231] [YOCTO #10317] [YOCTO #10353] decorator: Add base class OETestDecorator to provide a common way to define decorators to be used over OETestCase's, every decorator has a method to be called when loading tests and before test execution starts. Special decorators could be implemented for filter tests on loading phase. context: Provides HIGH level API for loadTests and runTests of certain test component (i.e. runtime, sdk, selftest). [YOCTO #10230] (From OE-Core rev: 275ef03b77ef5f23b75cb01c55206d1ab0261342) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>