aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
AgeCommit message (Collapse)Author
2017-08-23core/target/ssh.py: use reader to handle partial datarbt/ptestRobert Yang
This can avoid UnicodeDecodeError error. Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
2017-08-23core/target/ssh.py: replace decode errorsRobert Yang
There might be wild strings when read from target (especially when reading ptest results), replace the errors to avoid breaking the test. Fixed: (Not always happen) $ bitbake core-image-sato -ctestimage [snip] status, output = self.target.run('ptest-runner', 0) File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py", line 84, in run status, output = self._run(sshCmd, processTimeout, True) File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py", line 55, in _run status, output = SSHCall(command, self.logger, timeout) File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py", line 258, in SSHCall run() File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py", line 236, in run output = process.communicate()[0].decode("utf-8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 4906: invalid continuation byte [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23utils/logparser.py: fix section checkRobert Yang
The section might be None or '', so use "if section" for it. Fixed: File "/buildarea/lyang1/poky/meta/lib/oeqa/utils/logparser.py", line 113, in log_as_files prefix += section TypeError: Can't convert 'NoneType' object to str implicitly [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23runtime/cases/_ptest.py: rename it to ptest.pyRobert Yang
It works now. [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23runtime/cases/_ptest.py: add skip statusRobert Yang
The packages' test cases maybe skipped, check and save them. [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23oeqa/utils/logparser.py: add skip statusRobert Yang
Some test cases maybe skipped, let's parse it. [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23runtime/cases/_ptest.py: revive itRobert Yang
* Make it work with current oeqa * Skip the test if ptest is not in DISTRO_FEATURES * Skip the test if ptest-pkgs is not in IMAGE_FEATURES * The logs are saved to: testimage/ptest_log -> testimage/ptest_log.<datetime> * This provides data that could be used to detect regressions in ptest results [YOCTO #11547] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23runqemu: Use virtio to mount cdrom drivesRichard Purdie
The IDE driver in the kernel is fragile and in 4.12 is causing backtraces. To unblock 4.12 kernel merging use the virtio CD driver instead to mount iso images which should be faster and more stable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23oeqa/parselogs: Ignore device node warnings on mipsRichard Purdie
THe newner kernels have ope firmware support enabled which leads to warnings during boot on mips. These aren't interesting and we should ignore them. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-16dnf: expand dnf selftest to test signed package feedsMarkus Lehtonen
[YOCTO #11209] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-16oeqa: fix dnf testsMarkus Lehtonen
Rename one dnf runtime test that it will recognized as a python module and thus also found by the oe test loader. Also, fix value of TEST_SUITES in dnf selftest so that all test dependencies are satisfied and the runtime test may be successfully run from there. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-16selftest/tinfoil: Filter LogRecords in test_event_waitRichard Purdie
As the code stands today, an event mask does not mask LogRecord events since the log levels are controlled separately. We therefore need to accept (and ignore) LogRecord events in this test to avoid errors. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-16selftest: fix distrodata.py to use per-recipe UPSTREAM_VERSION_UNKNOWN settingAlexander Kanavin
... instead of a global exception list which was problematic. [YOCTO #11896] Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-11sstatetests: limit the number of signature comparisons when differLeonardo Sandoval
For perfomance reasons, limit the number of signature comparisons when stamps differ. The limit set is hardcoded to 20. [YOCTO #11651] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-11oeqa/buildoptions: remove unsafe-references-in-script testRoss Burton
This QA test is about to be deleted, so remove it from selftest. Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-11context: 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] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-11oeqa/runtime_test: use subtests in test_postinst_rootfs_and_bootRoss Burton
As this test has two nested loops and actually runs six times, use UnitTest.subTest() so we can tell which instance is failing, and to run all variations instead of failing on the first one. Also set PACKAGE_CLASSES to just the type we need to reduce the verboseness of the output, and consolidate the feature generation to be neater. Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-08sstatetests: Use python function instead of bitbake-diffsigs scriptLeonardo Sandoval
Using a python function instead of launching a subprocess fasten the diffsigs computation. [YOCTO #11651] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30imagefeatures: Add a test for various hypervisor formatsTom Rini
We add a new test that will create core-image-minimal for wic.vmdk, wic.vdi and wic.qcow2. We then confirm via qemu-img that the resulting file is of the expected type. Cc: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30imagefeatures: Add a test for many CONVERSION_CMDs being chainedTom Rini
Add a new test to create a long (and not otherwise useful) image, ext4.bmap.gz.bz2.lzo.xz.u-boot and also the sha256sum of it. Check that the resulting sha256sum is valid. Cc: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30imagefeatures: Extend test_bmap to validate gzipTom Rini
We extend the existing test_bmap test to also produce an ext4.bmap.gz file and then have gzip confirm that it contains valid gzip data. This tests that we are able to chain at least 2 CONVERSION_CMDs together. Cc: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30image: Convert vmdk/vdi/qcow2 to strict CONVERSION_CMD typesTom Rini
The vmdk/vdi/qcow2 IMAGE_FSTYPEs predate wic. As such, they provide some similar underlying functionality in order to produce a "disk" image that in turn can be converted into different formats that various hypervisor types work with. They do not however provide the ability for other disk image types to be converted into these same output types. Furthermore, they are less flexible than what wic does provide. This drops the old style vmdk/vdi/qcow2 types and re-introduces them under the CONVERSION_CMD framework. The equivalent of vmdk is now wic.vmdk and so forth for the other types. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30oe-selftest: wic: fix test_quemuEd Bartosh
This test case boots the image in qemu and checks for mounted partitions. As /boot is mounted automatically the test case fails. Fixed this by adding /boot to the list of mounted partitions. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30oeqa/core/runner: OEStreamLogger don't buffer test execution writesAníbal Limón
Since OEQA framework uses Python logging functionality to report test results there is a class that wraps PyUnit writes into logging commands (OEStreamLogger), so don't buffer the actual test execution to have insight of what is currently executing. This fix will change a little the test output format adding an '\n' previous the test result, for example: From: test_nonmatching_checksum (lic_checksum.LicenseTests) ... ok To: test_nonmatching_checksum (lic_checksum.LicenseTests) ... ok This is because the new line added by the PyUnit StreamLogger because currently we don't have a manner to identify when a test execution starts at report level (write msg). [YOCTO #11827] Signed-off-by: Aníbal Limón <anibal.limon@linux.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] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27oe-selftest: wic: change mkfs.btrfs optionsEd Bartosh
test_mkfs_extraopts test case fails on ab with error caused by using -K --mixed options: output: extent-tree.c:2696: btrfs_reserve_extent: BUG_ON `ret` triggered, value -28 For this test case it's not important to use particular options, so changing options to anything less influential is OK. Changed extra options for mkfs.btrfs to '--quiet' to fix the failure. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-25oeqa/buildperf: Add 'bitbake -m' on sync function to ensure bitbake is unloadedJose Perez Carranza
Add 'bitbake -m' to the sync method and ensure all process related to bitbake are correctly unloaded before doing the different measurements. Also add a call to sync funtion on Test4 before final measurment of eSDK deploy dir disk usage. Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21oe-selftest: wic: add test_mkfs_extraopts test caseEd Bartosh
Test new wks option --mkfs-extraopts with all filesystems supported by wic. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-21oeqa/selftest/{context,case}: Handle KeyboardInterrupt/SIGINT and SIGTERMAníbal Limón
In order to avoid corrupt local.conf and bblayers.conf adds signal handler for SIGTERM and use try/finally (KeyboardIntrrupt) block to restore previously backuped configuration. [YOCTO #11650] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-07-21selftest/cases/package: Call parent setUpClass methodAníbal Limón
Since config paths are now passed in Test context the setUpClass method is expected to be call. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-07-21oeqa/core/loader: Generate function _make_failed_test dynamicallyAníbal Limón
Python versions has different features from branches 3.4.x, 3.5.x and 3.6.x, i expected in wrong mode that was incremental for example changes in 3.4.4 be in 3.5.x but that's not true. The _make_failed_test internal method differs and is only available in certain versions >= 3.4.4 and in 3.5.x and 3.6.x branches but not realeses have been made including it. So to avoid futher problems inspect the _make_failed_test and generates function definition according what parameters are needed, the unique supossition is that exception argument is always passed. Related to, http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=d8380d098a290510b442a7abd2dd5a50cabf5844 Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2017-07-21oeqa/eSDK: Ignore errors during directory cleanupRichard Purdie
The cleanup can fail with: ERROR [0.000s]: tearDownClass (eSDK.oeSDKExtSelfTest) FileNotFoundError: [Errno 2] No such file or directory: 'bitbake.sock' which is due to bitbake taking a small amount of time to shut down the server. The easiest fix is just to ignore these kinds of errors, bitbake shouldn't create any new files during shutdown. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-17imagefeatures: add test_image_fstypes test caseEd Bartosh
Tested if core-image-minimal can be built for existing fstypes by building an image and checking if result file <image>.<fstype> exists in the image deploy directory. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-17selftest: fixed 5 wic test casesEd Bartosh
Added core-image-minimal -> syslinux dependency to ensure syslinux artifacts are available from core-image-minimal build. This should fix test_iso_image, test_bootloader_config and test_default_output_dir test cases. Used --native-sysroot in test_image_vars_dir_long and test_image_vars_dir_short test cases to point out to wic-tools native sysrtoot. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-08oeqa/tinfoil: Improve test_wait_event for race issuesRichard Purdie
The test could break in a variety of ways: a) If BB_HEARTBEAT_EVENT was less than ~0.25 it would hang indefinitely b) The mask is set after draining the event queue meaning a heartbeat event could have happened c) The test exits once it sees the events it wants, it doesn't check for spurious events such as heartbeats which shouldn't have occured. d) The hardcoded delay of 0.25 is nasty and shouldn't be needed. I found a bitbake bug and fixed that meaning we don't need the delay any more which fixes d). That means a) is no longer an issue either. We now set the mask, then drain the queue meaning no spurious events should be able to sneak in. The test is also tweaked to wait for 5s in total to ensure spurious events don't occur such as heartbeat events we shouldn't see. [YOCTO #11045] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-08oeqa/sdk: Replace buildiptables for buildlzip testsJose Perez Carranza
Buildiptables test cases are conflicting with images built with “musl” as standard C library, in order to avoid those issues lzip package was selected to be used on the tests as this does not have any "musl" dependency. [YOCTO #11713] Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-08oeqa/runtime: Replace buildiptables for buildlzip on runtime testsJose Perez Carranza
Buildiptables test cases are conflicting with images built with “musl” as standard C library, in order to avoid those issues lzip package was selected to be used on the tests as this does not have any "musl" dependency. This patch is applicable for testimage tests [YOCTO # 11713] Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28runcmd.py: unit testing for runCmd()Patrick Ohly
This covers the traditional API as well as the new output_log feature. While testing, it was noticed that killing hanging commands does not work when a shell is used to run the command(s). This might be worth fixing. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28commands.py: live output logging + result.error encoding fixPatrick Ohly
Tests that use bitbake("my-test-image") can run for a long time without any indication to the user of oe-selftest about what's going on. The test author has to log the bitbake output explicitly, otherwise it is lost in case of test failures. Now it is possible to use bitbake("my-test-image", output_log=self.logger) to get more output both on the console and in the XML output (when xmlrunner is installed). Example output: 2017-06-23 12:23:14,144 - oe-selftest - INFO - Running tests... 2017-06-23 12:23:14,145 - oe-selftest - INFO - ---------------------------------------------------------------------- 2017-06-23 12:23:14,151 - oe-selftest - INFO - Running: bitbake my-test-image 2017-06-23 12:23:16,363 - oe-selftest - INFO - Loading cache...done. 2017-06-23 12:23:17,575 - oe-selftest - INFO - Loaded 3529 entries from dependency cache. 2017-06-23 12:23:18,811 - oe-selftest - INFO - Parsing recipes...done. 2017-06-23 12:23:19,659 - oe-selftest - INFO - Parsing of 2617 .bb files complete (2612 cached, 5 parsed). 3533 targets, 460 skipped, 0 masked, 0 errors. 2017-06-23 12:23:19,659 - oe-selftest - INFO - NOTE: Resolving any missing task queue dependencies Because the implementation was already using threading, the same is done to decouple reading and writing the different pipes instead of trying to multiplex IO in a single thread. Previously the helper thread waited for command completion, now that is done in the main thread. The most common case (no input data, joined stdout/stderr) still uses one extra thread and a single read(), so performance should be roughly the same as before. Probably unintentionally, result.error was left as byte string when migrating to Python3. OE-core doesn't seem to use runCmd() with split output at the moment, so changing result.error to be treated the same as result.output (i.e. decoded to a normal strings) seems like a relatively safe API change (or rather, implementation fix). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> merge: wait() Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28selftest/archiver: only execute deploy_archives taskAndré Draszik
There should be no reason to execute a full build, as we're just interested in the deployment of the archives. The newly added tests already do the same. Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28selftest/archiver: add tests for recipe type filteringAndré Draszik
The archiver used to be able to filter based on COPYLEFT_RECIPE_TYPES. Unfortunately, this got broken with the fix for https://bugzilla.yoctoproject.org/show_bug.cgi?id=6929 in commit ae9102bda398 ("copyleft_filter.bbclass: Allow to filter on name") Add two tests to prevent that from happening again. Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28selftest/seltest.py: Add test to check imports from other layersJose Perez Carranza
This tests adds a check of selftest itself to verify if can add test from other layers. [YOCTO #9770] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28meta: Fix return value checks from subprocess.call()'sMikko Rapeli
Python function subprocess.call() returns the return value of the executed process. If return values are not checked, errors may go unnoticed and bad things can happen. Change all callers of subprocess.call() which do not check for the return value to use subprocess.check_call() which raises CalledProcessError if the subprocess returns with non-zero value. https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module All users of the function were found with: $ git grep "subprocess\.call" | \ egrep -v 'if.*subprocess\.call|=\ +subprocess\.call|return.*subprocess\.call' Tested similar patch on top of yocto jethro. Only compile tested core-image-minimal on poky master branch. Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28selftest/devtool: Don't use removed remake as test caseJussi Kukkonen
remake was removed from oe-core: use another recipe in the devtool extract test. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-28oe-selftest: add a test for upstream version check regressionsAlexander Kanavin
The test runs an upstream version check, and then compares the list of recipes that failed the check (i.e. those where latest upstream version could not be established) against the list of known-broken upstreams. Mismatches either way (upstream check failed, recipe not in the exception list, or upstream check worked, recipe in exception list) fail the test. [YOCTO #11031] Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
2017-06-23oeqa/selftest/context: Reload testlayer_path when meta-selftest isn't addedAníbal Limón
When add meta-selftest by the script the testlayer_path needs to be reloaded to avoid None value. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23oeqa/core/loader.py: Fix _make_failed_test for python >= 3.4.4Aníbal Limón
Python unittest change the signature of the _make_failed_test after python 3.4.4 don't pass the method name. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23oeqa/core/threaded: Don't assume that results exists on logDetailsAníbal Limón
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23selftest: Add Testopia ID to test casesJose Perez Carranza
Add decorator @OETestID() with proper Tesopia TC ID to the test cases that did not have it set. Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-23selftest/devtool: replace file assertTrue/False with assertExists/NotExistsYeoh 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 Replce assertTrue/assertFalse with assertExists/assertNotExists to test file path, this will improve assertion message and simplify coding, self.assertExists(filepath) will print below 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>