aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib
AgeCommit message (Collapse)Author
2017-06-07buildhistory: skip tests if GitPython module is missingLeonardo Sandoval
Catching a possible exception when importing the git module, allows us to skip test if the latter is missing on the host. Also, import oe.buildhistory_analysis inside fuctions because this module also needs git to work correctly. [YOCTO #11620] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-05oeqa/core/loader: Call parent init method in OETestLoaderAnibal Limon
After Python 3.5 the init method contains initialization of _loading_packages set to avoid infinite loops in recursive loading. Fix, Traceback (most recent call last): File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/scripts/oe-selftest", line 70, in <module> ret = main() File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/scripts/oe-selftest", line 57, in main results = args.func(logger, args) File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/context.py", line 214, in run rc = self._internal_run(logger, args) File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/context.py", line 175, in _internal_run self.tc.loadTests(self.module_paths, **self.tc_kwargs['load']) File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/core/context.py", line 51, in loadTests self.suites = self.loader.discover() File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/core/loader.py", line 268, in discover pattern='*.py', top_level_dir=path) File "/usr/lib/python3.5/unittest/loader.py", line 341, in discover tests = list(self._find_tests(start_dir, pattern)) File "/usr/lib/python3.5/unittest/loader.py", line 398, in _find_tests full_path, pattern, namespace) File "/usr/lib/python3.5/unittest/loader.py", line 473, in _find_test_path self._loading_packages.add(name) AttributeError: 'OETestLoader' object has no attribute '_loading_packages' Signed-off-by: Anibal Limon <anibal.limon@linux.intel.com>
2017-06-05oeqa/runtime/context.py: Add support to specify port in target_ipAníbal Limón
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-05oeqa/selftest/cases: Migrate test cases into the new oe-qa frameworkLeonardo Sandoval
New framework has different classes/decorators so adapt current test cases to support these. Changes include changes on base classes and decorators. Also include paths in selftest/__init__.py isn't needed because the loader is the standard unittest one. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05scripts/oe-selftest: Migrate to new framework into oeqa.selftest.contextLeonardo Sandoval
The new OEQA framework aims to re-use code into the different Test components. The previous oe-selftest implements it-self loading, run, and list test cases in a non-standard way (unittest base) and other functionalities like logging that is now on oeqa core. This ends on a compact oe-selftest script. All needed command line options was migrated but there are some of them pending of implementation and others deprecated. Deprecated options: list-tags: The tag functionality into the old oeqa framework isn't work, the selftest doesn't has tag decorators. {run, list}-tests-by: Ambiguos options it accepts all the posibilites module, class, name, id or tag. Remaining to implement: coverage: It enables covrage reports over a test run, currently isn't on on use and some bugs [1], i filed a bug to add support to OEQA core module in this way other Test components could enable it. repository: It push XML results into a git repository and isn't in use, i filed a bug to implement this into OEQA core module. [2] [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=11582#c0 [2] https://bugzilla.yoctoproject.org/show_bug.cgi?id=11583#c0 Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05oeqa/selftest/case: Don't figure out the testlayer insideAníbal Limón
The test layer is added at init of selftest and is the same across test runs so pass it as a attr in the context. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05oeqa/selftest/case.py: Remove machine selection logicLeonardo Sandoval
The machine selection is an operation that needs to be made in every test run, the best place to it is on the context module. Use self.tc.custommachine variable instead of use environment. SIgned-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05scripts/oe-selftest: Move {add,remove}_include files to caseLeonardo Sandoval
The oe-selftest creates include files to store custom configuration to make specific tests, every class executes a different test and may be uses custom configuration. So move to case class in order to simplify oe-selftest script and later implement later a build folder per class. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05oeqa/selftest/case: Migrate case class to the new OEQA frameworkLeonardo Sandoval
Summary of the changes: - Use OETestCase as base class instead of unittest.TestCase - Remove LogResults decorator the new framework provides logging into the core functionality. - Logger is now self.logger instead of self.log - Move comments into docstrings in several help methods - Use get_test_layer() method instead of access monkey patched variable in old oeSelfTest case class. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05oeqa/selftest: Move base class to case moduleAníbal Limón
To match the new structure of the OEQA framework. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05scripts/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). Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-06-05oeqa/selftest: lock down Meson git revision for reliabilityRoss Burton
The test_recipetool_create_github test fetches HEAD of the repository so upstream changes can (and do) break the test. Avoid these problems by passing the rev= argument in the URL to lock the checkout to the same version that is fetched in the github_tarball test. Also pass the commands to runCmd() as a list instead of a string, the semicolon in the URL needs more quotes if the shell is involved and passing a list bypasses the shell entirely. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-04oeqa/core: Improve grammar in README and loader commentsRandy MacLeod
Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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 Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/context: Raise exception when a manifest is specified but missingLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/case: fix typo on comment about exception nameLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/README: Improve documentationLeonardo Sandoval
Most of the text include on this text refactor came from [1]. [1] http://lists.openembedded.org/pipermail/openembedded-architecture/2016-December/000351.html Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/runtime/case: Don't use OEQA framework internal methodsAníbal Limón
The OEQA framework has internal methods for provide functionality in decorators so Test components aren't expected to override it. Use the base unittest methods for setUp and tearDown. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/sdk: Enable usage of OEQA thread modeAníbal Limón
oeqa/sdk/context.py - Use OETestContextThreaded. classes/testsdk.bbclass - Enable bb event thread mode to avoid corrupt the PIPE when multiple threads writes. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/tests: Add tests of OEQA Threaded modeAníbal Limón
Add needed tests to validate the OEQA Threaded mode, the remaining parts are tested by the OEQA without Threaded mode. - test_loader.py: Add a test to validate rules when creating the list of test suites. - test_decorators.py: Add oetimeout test because the threaded mode uses Timer instead of signal. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/sdkext/cases: Move sdk_update test into devtool moduleAníbal Limón
With the new OEQA thread support there are problems running devtool twice at the same time because only one instance of bitbake/devtool is allowed. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/decorator/oetimeout: Add support for OEQA threaded modeAníbal Limón
In python signals are only allowed to delivery into the main thread, to support the threading mode test if the runner is threaded and use threading.Timer instead. There are some considerations like SIGALRM interrupts the execution after N seconds but the Timer only starts a Thread to notice the timeout and the exception will be raised when the test run ends. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/decorator/depends: Add support for threading modeAníbal Limón
The _skipTestDependency needs to know if the thread mode is enabled because the _results are by thread. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/threaded: Add OETestContextThreaded classAníbal Limón
This class sets the {loader,runner}Class to the threaded versions and overrides loadTests method to be able specify the process_num. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/threaded: Add support of OETestRunnerThreadedAníbal Limón
The OETestRunnerThreaded overrides the run method of OETestRunner it recieves a list of suites to be executed by a ThreadPool. The new run method handles the ThreadPool creation and the OETestResultThreaded fill. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/threaded: Add OETestResultThreaded{,Internal} classesAníbal Limón
The OETestResultThreadedInternal extends OETestResult to stores results by Thread. The OETestResultThreaded is a simple class that provides the implementation of interfaces needed by outside like wasSuccesful, stop, logSummary, logDetails. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/runner: OETestResult add internal _tc_map_resultsAníbal Limón
This method is to assign results into the TestContext, create an internal one to support change implementation in Thread version. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/threaded: Add OEStreamLoggerThreaded classAníbal Limón
The OEStreamLoggerThreaded overrides OEStreamLogger to redirect the PyUnit output to a logger. Instead of log every line when comes the OEStreamLoggerThreaded will buffer the PyUnit output and write everything at end of every suite execution to don't have mixed suite outputs. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/threaded: Add new module with OETestLoaderThreadedAníbal Limón
The threded module will implement Thread support into the OEQA framework. The OETestLoaderThreaded overrides discover to return a list of suites every suite will be run by a separate Thread. Some design considerations are: - All the tests of a certain module needs to be run at one thread because unittest framework needs to keep track of setUp{Module, Class,} and tearDown{Module, Class,}. - Tests that depends on other needs to be run at the same thread because OEQA framework look at the status of dependant test to decide if skip or not, this constraint can be change in the future but a sync mechanishm is needed to implement between the Threads. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/runner: OETestResult remove unneeded override of startTestAníbal Limón
I override this method before for keep track of results and forget to remove it, now isn't need. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/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] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/sdk/context.py: Add return to OESDKTestContext.run() methodAníbal Limón
The run() methods of a OETestContext's are expected to return the results. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/sdk/context.py: Import argparse_oe at OESDKTestContext.run methodAníbal Limón
This import was at level of OESDKTestContext.register_commands but OESDKTestContext.run method need it to raise exceptions. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-25base.py: add assertExists and assertNotExists to oeselftestYeoh Ee Peng
Current osselftest print confusing assertion message when using self.assertTrue(os.path.exists(filepath)) to test file path, example of confusing assertion message: AssertionError: False is not true Add the assertExists and assertNotExists to improve assertion message and simplify coding, using selft.assertExists(filepath), will print meaningful assertion message: AssertionError: <filepath> does not exist [YOCTO #11356] Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-23oeqa.utils.git: use --verify in rev_parse()Markus Lehtonen
We use rev-parse for turning git object names into SHA-1 and checking their existence. Using --verify option makes sure git-rev-parse does what we expect. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-21selftest: fix test_unsupported_subcommand test caseEd Bartosh
Fixed failure of test_unsupported_subcommand caused by switching to argparser by checking that parser returns non-zero return code. [YOCTO #9636] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-18selftest/devtool: change write to append config in virtual_kernel_modifyAníbal Limón
When uses write it creates a full new configuration in selftest.inc causing to fail populate_sdk_ext linux-yocto because the signature of the sstate changes. [YOCTO #11300] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-18QemuRunner: avoid tainting os.environPatrick Ohly
That a utility function permanently changes the process environment is bad style and leads to subtle, hard to debug problems. For example, we had one oe-selftest which used runqemu() with an override for DEPLOY_DIR_IMAGE. Another test then just called runCmd() and ended up passing the wrong DEPLOY_DIR_IMAGE set earlier in os.environ. The approach used here is to pass the desired environment dict to the launch() method as a new, optional parameter, which then gets passed on to subproject.Popen(). The modified env variables do not get logged, as before. [YOCTO #11443] Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-18archiver.bbclass: do not cause kernel rebuildsPatrick Ohly
Adding or removing archiver.bbclass from a build configuration causes rebuilds of linux-yocto-based kernels because of the do_kernel_configme->do_unpack_and_patch task dependency. This particular dependency can be ignored for the do_kernel_configme sstate signature calculcation. Idea for the fix from Richard Purdie. Note that building the kernel and adding archiver.bbclass later to archive sources leads to do_unpack_and_patch running after do_kernel_configme (because that already ran in the first build), which might be problematic. This is independent of the change here. The use case in YOCTO #11441 is to removed archiver.bbclass between a production build with archiving enabled and builds via oe-selftests without archiving. That direction is fine. Fixes: YOCTO #11441 Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-16oeqa/selftest: add test for package manager version comparisonRoss Burton
This test case verifies that opkg, dpkg, and rpm all have the same behaviour for version ordering, specifically the behaviour of ~ which should be sorting *before* nothing: 1.0 < 2.0~pre < 2.0 < 2.0-fix Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-16oeqa/selftest: relax whitespace matches in search regexRoss Burton
Latest DNF has changed the amount of whitespace it outputs so use matches instead of hardcoding the exact number of spaces. Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-16selftest/runtime-test: Split the config valuesLeonardo Sandoval
Split the configuration values (common and specific) so it is easier to read what goes into the config file. Also the specific configurations are set in every loop so these do not append on each iteration. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-16oe.lsb: add get_os_release()Markus Lehtonen
Move get_os_release() from oeqa.utils.metadata to oe.lsb, merging the code with release_dict_osr() from oe.lsb. This removes some code duplication and makes get_os_release() more robust. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-12useradd: Create lib/oe/useradd function libraryRichard Purdie
The code in useradd-staticids is generally useful for user addition functionality but is not reusable in its current form. Refactor the code into a set of library functions. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-10parselogs: whitelist failed to enable keyboard error on intel-corei7-64California Sullivan
This error is seen on the Braswell RVP platform we have been using for testing. The error is caused by atkbd.c keyboard driver, which is only for AT and PS/2 keyboards. I tested a PS/2 keyboard with the board, which worked fine, and the board does not have a separate AT connector, so this error won't cause any functional issues. [YOCTO #10110]. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>