summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/base.py
Commit message (Collapse)AuthorAgeFilesLines
* oeqa/selftest: Move base class to case moduleAníbal Limón2017-06-061-248/+0
| | | | | | | | | | To match the new structure of the OEQA framework. (From OE-Core rev: 0d3d97414c8166d09065f6f7f45e3260ce405692) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* base.py: add assertExists and assertNotExists to oeselftestYeoh Ee Peng2017-05-251-0/+13
| | | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: b0a74554ef926ce05078494ca8e67178b56232f5) Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* selftest: remove extra backslashes from debug outputEd Bartosh2017-03-081-2/+2
| | | | | | | | | | | | | | | Remove unneeded backslashes from the format strings that caused debug output to look confusing: 2017-03-06 16:52:42,428 - selftest.base - DEBUG - Removing from: ... \IMAGE_FSTYPES = "wic" WKS_FILE = "mkefidisk.wks" (From OE-Core rev: 6b7f8f81307720b0a6c1ef4af5200dec9b8ef789) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* selftest/base: don't fetch DISTRO variable in constructorRoss Burton2017-01-161-1/+0
| | | | | | | | | | Fetching the DISTRO variable in the base constructor means that we have to start bitbake for every test case instance, which adds minutes to the startup time. (From OE-Core rev: ac1c118dcb3cb27807b55115ef274a92bb512dd6) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* selftest: base: new object member to store the DISTRO valueLeonardo Sandoval2016-12-161-0/+1
| | | | | | | | | | | | Instead of quering it multiple times, query once and use it on test method skip checks. Also, rename current distro sstate object member to a more meaninful name. (From OE-Core rev: bde9d99575a63ad2d7fd5974ce6ce19aad9a8984) 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>
* oeqa/selftest/base: backup and restore local configuration filesJose Lamego2016-09-231-1/+31
| | | | | | | | | | | | | | | | Selftests' cleanup method during test setup is not capable of restoring local configuration files that remain modified after aborting a test through a keyboard interruption. This change creates backups for local.conf and bblayers.conf at test setup, restore them when found, and deletes them at cleanup. [YOCTO #9390] (From OE-Core rev: 0877278e07e4c2494c4c23199490dc47a5cee69d) Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta/selftest/scripts: Use print function for python3 compatibilityRichard Purdie2016-05-211-1/+1
| | | | | | | | | | | | Used print function instead of print statement to make the code work in python 3. [Changes from both Ed and Richard] (From OE-Core rev: ced1995694c394d92cb82fb9c25a33dc027a3b69) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oeqa/selftest/base.py: Correct a reference to meta/lib/oeqa/selftestPeter Kjellerstedt2016-04-181-1/+1
| | | | | | | (From OE-Core rev: 4ed2a6d43ea19a3026d94666fc342493689d7d46) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/oe-selftest: Allow to run tests on random/all MACHINEsDaniel Istrate2016-01-071-6/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an option for random MACHINE into oe-selftest: --machine [random/all] 1. random: will set a random MACHINE for each test 2. all: will run tests for all machines Custom machine sets only weak default values (??=) for MACHINE in machine.inc. This let test cases that require a specific MACHINE to be able to override it, using (?= or =). e.g.: oe-selftest --run-tests signing --machine random --> will run all tests switching MACHINE randomly for each test oe-selftest --run-tests signing --machine all --> for each machine will run all tests oe-selftest --run-all-tests --machine random Also update oeqa/selftest/base.py to accomodate this feature. Fix for [YOCTO #5880]. (From OE-Core rev: 4a9c3653eecd9a3c1b45bab5e16c8d679c55f8bd) Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/selftest: clean up selftest.inc in teardownRoss Burton2015-10-211-1/+1
| | | | | | | | | | | | | | | Test cases may want to do call bitbake in setUpClass() but at that point the previous selftest.inc is still present which could change the build configuration and result in any built artifacts being removed in the next bitbake invocation as part of the sysroot clean up. Resolve this by cleaning selftest.inc in the tearDown, the clean in setUp should be considered a safety net. (From OE-Core rev: 573bd03a7844a5ad762533f65f41214df31cd197) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/selftest: Add methods to manipulate bblayers.conf in base.pyDaniel Istrate2015-07-081-0/+22
| | | | | | | | | | | | | Added methods for manipulating bblayers.conf file in the same manner as local.conf file: - write_bblayers_config - append_bblayers_config - remove_bblayers_config (From OE-Core rev: 477ed5931f40dd504a2ae3e184c09153f4fa9735) Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Added testcase decorator to use in logging. Added class decorator LogResults ↵Lucian Musat2014-07-031-0/+2
| | | | | | | | | 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>
* oe-selftest: Add track_for_cleanup method to be used in cleanup tasksCorneliu Stoicescu2013-12-141-0/+15
| | | | | | | | | | | | Added a track_for_cleanup(path) method that removes the given path in the tearDown method. This mechanism can be used to make sure a file or directory we created will be removed at the end of a test, regardless of what happens. (From OE-Core rev: 358415cf604089cc2dab547e231d062b9dc068ee) 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>
* oe-selftest: implement add_command_to_tearDown methodCorneliu Stoicescu2013-12-141-1/+17
| | | | | | | | | | | | | Add a new method that can be used by the tester to add a command to the executed in the tearDown stage of the test. This mechanism can be used to make sure certain test-specific cleanup tasks are done in the case of a test failure. (From OE-Core rev: b59466ec341e6596b7ade7f1813b25e454b11a32) 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>
* lib/oeqa/selftest/base, scripts/oe-selftest: fix wrong remove path and do a ↵Stefan Stanacar2013-12-051-1/+1
| | | | | | | | | | | | | | | | complete cleanup at the end The script should clean-up all the .inc files that might have been created by tests regardless of the outcome or if the script is interrupted. (currently the last test will leave a conf/selftest.inc around, even if it's not included anywhere) Also fix delete_recipeinc to actually delete what's supposed to. (From OE-Core rev: 6008745c56800e0f5f01a756be0701cebd9de4ae) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/oe-selftest: script to run builds as unittest against bitbake or ↵Stefan Stanacar2013-12-031-0/+98
various scripts The purpose of oe-selftest is to run unittest modules added from meta/lib/oeqa/selftest, which are tests against bitbake tools. Right now the script it's useful for simple tests like: - "bitbake --someoption, change some metadata, bitbake X, check something" type scenarios (PR service, error output, etc) - or "bitbake-layers <...>" type scripts and yocto-bsp tools. This commit also adds some helper modules that the tests will use and a base class. Also, most of the tests will have a dependency on a meta-selftest layer which contains specially modified recipes/bbappends/include files for the purpose of the tests. The tests themselves will usually write to ".inc" files from the layer or in conf/selftest.inc (which is added as an include in local.conf at the start and removed at the end) It's a simple matter or sourcing the enviroment, adding the meta-selftest layer to bblayers.conf and running: oe-selftest to get some results. It would finish faster if at least a core-image-minimal was built before. [ YOCTO #4740 ] (From OE-Core rev: 41a4f8fb005328d3a631a9036ceb6dcf75754410) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>