aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib
AgeCommit message (Collapse)Author
2018-11-30oe-selftest: add some tests for recipeutils modulepaule/devtool-recipeutils-fixesPaul Eggleton
Add some tests for functions in meta/lib/oe/recipeutils.py, in particular for a few issues I've just fixed. I haven't added tests for all of the functions - some of them are already being tested via devtool in any case. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-28lib/oe/recipeutils: drop obsolete functionsPaul Eggleton
These date from the time before Tinfoil's API covered this functionality (back when you could actually access cooker from a tinfoil-based script). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-28lib/oe/recipeutils: patch_recipe(): fix replacing varflag valuesPaul Eggleton
The code here wasn't correctly getting the variable history for varflags, so for example if you did a devtool upgrade on a recipe where the SRC_URI checksums were in the .inc file (typical for python recipes in order to support both python 2 and 3) then after the upgrade the new values would be set in the recipe and the old values were left in the .inc, which is not right. Teach the code here how to get the history for varflags so it works properly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-28lib/oe/recipeutils: patch_recipe(): fix handling of values across ↵Paul Eggleton
includes/classes If we were setting a variable and part of the variable's value was being set in a class or a .inc file, we were still just setting the value outright on the assumption that it was too hard to do otherwise. With some careful use of the variable history we can do better for certain situations i.e. when the recipe does not currently set the value outright. Additionally, correctly remove _appends for variables we are changing if we're trying to remove the value added in the _append. Fixes [YOCTO #12623] and partially fixes [YOCTO #9360]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-27oeqa/selftest/buildoptions: Improve ccache test failure outputRichard Purdie
The current failure mode doesn't show us what the logs actually looked like and later cleans can lose them. Show the whole log in case of failure to aid debugging intermittent problems on the autobuilder. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-27oeqa/selftest/case: Use bb.utils.remove() instead of shutil.remove()Richard Purdie
This avoids problems where shutil.remove will error with: File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd os.unlink(name, dir_fd=topfd) FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' when there are races over file deletion (gpg agent may be slow to exit). We already worked around speed and race issues in bb.utils. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-26oeqa/selftest/signing: Use do_populate_lic target instead of do_packageRichard Purdie
This should speed the test up signficiantly without any loss of functionality for the purposes of the test. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-26oeqa/selftest/signing: Allow tests not to need gpg on the hostRichard Purdie
We ideally don't want to use gpg from the host. This is straightforward for package management but not for sstate. For sstate, create a second build directory to run the test in using gnupg-native from the original build directory. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-26oeqa/selftest/signing: Skip tests if gpg isn't foundRichard Purdie
Raising an assertionError in the class setup isn't a particuarly good way to indicate gpg isn't installed. Instead skip the tests if the required binary isn't present. For the signing tests we do require it to be present and can't use a prebuilt one. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22terminal: Cope with unreleased versions of tmuxMike Crowe
When tmux is built from a non-release Git version, its version number is "next-X" where X appears to be the expected version number for the next release. For example, when built from the current state of master, running "tmux -V" yields: tmux next-2.9 Currently check_tmux_pane_size only checks for the version being less than 1.9, so it seems unfair to fail with an obscure Python error in this case. Let's just use the version number after the "next-" prefix if it is present. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22oeqa/qemu: Add support for slirpYeoh Ee Peng
Enable qemu for slirp. Initialize Qemurunner with slirp. Setup ip and port attribute to enable connection with qemu running with slirp. [YOCTO#10713] Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22qemurunner: Add support for slirpYeoh Ee Peng
Enable qemurunner for slirp. Retrieved the ip & port from host machine to connect to qemu from host machine. [YOCTO#10713] Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22oeqa/qemu & runtime: qemu do not need ip input from externalYeoh Ee Peng
Qemu do not use the ip input from external. It will retrieve ip from QemuRunner instance and assign ip value. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-21package_manager.py: fix the message used to catch failing postinsts from dnfAlexander Kanavin
Latest dnf versions have tweaked it. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-20classes/testsdk: Split implementation into classesJoshua Watt
Splits the SDK test implementation into configurable Python classes. The classes used for the normal and extensible SDKs are ${TESTSDK_CLASS_NAME} and ${TESTSDKEXT_CLASS_NAME} respectively. This allows SDK machines to override the classes used to implement the tests. For the traditional SDK, a common "run()" function is provided by the class (oeqa.sdk.testsdk.TestSDK), with several hook member functions that can be overridden in child classes, making it easier to have consistent behavior. The extensible SDK class (oeqa.sdkext.testsdk.TestSDKEXT) also has a common "run()" function, but no hooks have yet been added as there is not currently a known use case for create derived classes. These changes should be purely organizational; no functional changes have been made to either the standard SDK or extensible SDK tests. [YOCTO #13020] Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16oeqa/utils/httpserver: Rework to avoid hangs and improve loggingRichard Purdie
testimage.bbclass installs a SIGTERM handler which conflicts with the use of multiprocessing here. This is paritcularly problematic if the http service is terminated before its started and hence before its had a chance to reset the default signal handler (as the code was written). Instead, temporarily remove testimage's handler whilst forking the http process which means the correct handler is installed and won't deadlock. Also take the opportunity to add in some log messages about the server start and shutdown so that future debugging is easier and its clearer what the code is doing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16testimage/testsdk/selftest: Avoid platform.distro_identifier deprecation ↵Richard Purdie
warnings Use our own lsb function instead as used elsewhere by the codebase. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16oeqa/concurrencytest: Avoid unclosed file warningsRichard Purdie
Avoid an unclosed file per thread warning when running selftests concurrently by closing the result stream. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16lib/oe/package_manager: Avoid race problems when calling list_pkgs()Richard Purdie
list_pkgs() for rpm calls RpmPM() which would try and create a copy of the package feed. This can be called for example from buildhistory whilst some other task may be working on an SDK or image construction, causing the package feed to disappear part way through an operation. Avoid the need to copy the package index just to list the installed packages, avoiding the race. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16oeqa/utils/qemurunner.py: Fix python regex warningsRichard Purdie
Fix the warnings: meta/lib/oeqa/utils/qemurunner.py:250: DeprecationWarning: invalid escape sequence \. ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) meta/lib/oeqa/utils/qemurunner.py:343: DeprecationWarning: invalid escape sequence \- if re.search("root@[a-zA-Z0-9\-]+:~#", output): poky/meta/lib/oeqa/utils/qemurunner.py:350: DeprecationWarning: invalid escape sequence \- if re.search("root@[a-zA-Z0-9\-]+:~#", output): meta/lib/oeqa/utils/qemurunner.py:448: DeprecationWarning: invalid escape sequence \- if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data): by correctly marking the regexs. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16oeqa/selftest/context: Replace deprecated imp module usageRichard Purdie
Avoid the warning: meta/lib/oeqa/selftest/context.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp In this case importlib is a direct replacement. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/utils/commands: Avoid unclosed file warningsRichard Purdie
Avoid warnings such as: meta/lib/oeqa/utils/commands.py:213: ResourceWarning: unclosed file <_io.BufferedReader name=4> return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/core/runner: Correctly markup regexsRichard Purdie
Avoid the warning "DeprecationWarning: invalid escape sequence \(" by marking the regexs correctly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/loader: Fix deprecation warningRichard Purdie
Clean up the warning: meta/lib/oeqa/core/loader.py:27: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec() _failed_test_args = inspect.getargspec(unittest.loader._make_failed_test).args Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runner: Sort the test result output by result classRichard Purdie
We want to see failures/errors listed last since this is the most easily visible part of the log on consoles or autobuilder output and makes human processing easier rather than having to scroll up and scan for a single failure. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runner: Always show a summary of success/fail/error/skip countsRichard Purdie
Its useful to have the counts of success/failure/error/skipped at the end of the results to allow for easier human reading of what happened. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13locale: Allow usage of cross-localedef for ARCAlexey Brodkin
With this it's possible to build locale data for ARC and not do it instead on the first boot. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runtime/cases: Improve dependencies of kernel/gcc/build testsRichard Purdie
Mark up these tests as needing a compiler, make and kernel source code as appropriate, the image feature requirements can then be retired. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runtime/cases: Improve test dependency informationRichard Purdie
Add the OEHasPackage decorator to a variety of tests so they determine automatically if they should run against a given image. To ensure tests can do this we need to move target operations such as scp commands into the tests and out of the class startup/teardown. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13testsdk: fix skipped testcase output "UNKNOWN" status while multiprocess ↵Hongxu Jia
execution Usually skipped testcase output "SKIPPED" [snip serial execution] |RESULTS - buildgalculator.GalculatorTest.test_galculator - Testcase -1: SKIPPED (0.01s) |RESULTS - python.PythonTest.test_python3 - Testcase -1: SKIPPED (0.01s) [snip serial execution] But if enable multiprocess execution, skipped testcase output "UNKNOWN" status [snip enable multiprocess execution] |RESULTS - buildgalculator.GalculatorTest.test_galculator - Testcase -1: UNKNOWN |RESULTS - python.PythonTest.test_python3 - Testcase -1: UNKNOWN [snip enable multiprocess execution] Here is my investigation: There is a class pairs TestProtocolClient and TestProtocolServer provided by python3-subunit. The TestProtocolClient generates a subunit stream of TestResult from a test run, and TestProtocolServer parses the stream of subunit TestResult. The class ProtocolTestCase is a unittest.TestCase adapter and it uses TestProtocolServer to parse the stream of subunit TestResult. In Yocto testsdk, it forks multiple processes to execute testcases and use TestProtocolClient to generate TestResult stream; and then it creates multiple threads to use ProtocolTestCase to parse stream of subunit TestResult through pipe; finally it passes multiple ProtocolTestCase as TestCase instance to main process and output status result. The problem point is TestProtocolServer parses `skip:' directive after reading a `test:' directive. Without `test:' directive, `skip:' directive will be ignored. All above requires SkipTest should be raised inside a test method rather than setUpClass method. Throwing SkipTest inside setUp works correctly Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runtime/utils/targetbuildproject: Use a subdir within ~/Richard Purdie
Without doing this, the code can and sometimes does try and do "rm ~/" which I think we'd all prefer it didn't. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/utils/buildproject: Only clean files if we've done somethingRichard Purdie
We should only be wiping out things on target if the tests have actually run. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/manual/build-appliance: Drop test which is already automatedRichard Purdie
The nightly-build-appliance target already tests this particular build. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13oeqa/runtime: Add tests for gstreamer CLIYeoh Ee Peng
We should not be finding GStreamer issues right around release time but that's what we seem to do. Port gstreamer tests from Intel Ref Kit. https://github.com/intel/intel-iot-refkit/blob/master/meta-iotqa/ lib/oeqa/runtime/multimedia/gstreamer/gstreamer_cli.py Add tests for gstreamer commandline tools (gst-inspect-1.0 & gst-launch-1.0). [YOCTO #11418] Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-09oeqa/selftest/recipetool: Fix problems from changing upstream sourceMohamad Noor Alim Hussin
The upstream source tarball checksums changed. Use the copy from our source mirror to avoid failures. [YOCTO #12979] Signed-off-by: Mohamad Noor Alim Hussin <mohamad.noor.alim.hussin@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-09image-buildinfo,oeqa/selftest/containerimage: Ensure image-buildinfo doesn't ↵Richard Purdie
break tests Having image-buildinfo enabled causes containerimage.ContainerImageTests.test_expected_files to fail due to the presence of an unexpected file: ['./', './etc/', - './etc/build', './etc/default/', './etc/default/postinst', Tweak the class to allow it to be disabled and disable it from the test just in case it was enabled. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-08oeqa/selftest: Standardize json logging output directoryYeoh Ee Peng
Currently sdk & sdkext will output json file to LOG_DIR, while selftest will output json file to TOPDIR/log. Standardize selftest json output file to LOG_DIR. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-06oeqa/selftest: Add test for Yocto source mirror functionality/completenessRichard Purdie
We've had a number of occasions where the Yocto Project source mirrors have not been complete or functioning correctly. This adds a test so that if this happens we find out out it sooner. It also only works over http meaning we should be able to test that anyone behind an http only proxy (no git protocol) also has functional fetches for OE-Core and layers built by the core of the project. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-06oeqa/runtime/ptest: Inject results+logs into stored json results fileRichard Purdie
This allows the ptest results from ptest-runner, run in an image to be transferred over to the resulting json results output. Each test is given a pass/skip/fail so individual results can be monitored and the raw log output from the ptest-runner is also dumped into the results json file as this means after the fact debugging becomes much easier. Currently the log output is not split up per test but that would make a good future enhancement. I attempted to implement this as python subTests however it failed as the output was too confusing, subTests don't support any kind of log output handling, subTest successes aren't logged and it was making things far more complex than they needed to be. We mark ptest-runner as "EXPECTEDFAILURE" since its unlikely every ptest will pass currently and we don't want that to fail the whole image test run. Its assumed there would be later analysis of the json output to determine regressions. We do have to change the test runner code so that 'unexpectedsuccess' is not a failure. Also, the test names are manipuated to remove spaces and brackets with "_" used as a replacement and any duplicate occurrences truncated. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/utils/metadata: Allow to function without the git moduleRichard Purdie
The python git module may or may not be enabled, allow this code to function without it, falling back to the same method as metadata_scm.bbclass uses. This will be cleaned up in the next round of feature development. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/core/runner: Don't add empty log entriesRichard Purdie
There is no point in adding empty log entries to the json result files, only add them if there is log data. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/selftest: Improvements to the json loggingRichard Purdie
Tweak the preceeding commit to: * Add STARTTIME to the identifier to make it unique * Use LOG_DIR * Store the layer config in a more natural json format * Drop '_' function prefixes Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/selftest/context: write testresult to json filesYeoh Ee Peng
As part of the solution to replace Testopia to store testresult, OEQA selftest need to output testresult into json files, where these json testresult files will be stored into git repository by the future test-case-management tools. By default, json testresult file will be written to "oeqa" directory under the oe-selftest log directory. To configure multiple instances of bitbake to write json testresult to a single testresult file at custom directory, user will define the variable "OEQA_JSON_RESULT_DIR" with the custom directory for json testresult. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/core/runner: write testresult to json filesYeoh Ee Peng
As part of the solution to replace Testopia to store testresult, OEQA need to output testresult into single json file, where json testresult file will be stored in git repository by the future test-case-management tools. The json testresult file will store more than one set of results, where each set of results was uniquely identified by the result_id. The result_id would be like "runtime-qemux86-core-image-sato", where it was a runtime test with target machine equal to qemux86 and running on core-image-sato image. The json testresult file will only store the latest test content for a given result_id. The json testresult file contains the configuration (eg. COMMIT, BRANCH, MACHINE, IMAGE), result (eg. PASSED, FAILED, ERROR), test log, and result_id. Based on the destination json testresult file directory provided, it could have multiple instances of bitbake trying to write json testresult to a single testresult file, using locking a lockfile alongside the results file directory to prevent races. Also the library class inside this patch will be reused by the future test-case-management tools to write json testresult for manual test case executed. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-28package_manager.py: correct the deploydir when packagefeed-stability inheritedMingli Yu
After create_packages_dir added in below commit: 85e72e1 package_manager: Filter to only rpms we depend upon When add below line into conf/local.conf INHERIT += "packagefeed-stability" There comes below error when do_rootfs Exception: FileExistsError: [Errno 17] File exists: '/$Prj/tmp/deploy/rpm-prediff/i586/initscripts-1.0-r155.i586.rpm' -> '/$Prj/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo/rpm-prediff/i586/initscripts-1.0-r155.i586.rpm' def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies): [snip] bb.utils.remove(subrepo_dir, recurse=True) [snip] In create_packages_dir function, there is a logic as bb.utils.remove(subrepo_dir, recurse=True) to clean subrepo_dir which is actually as example is /$Prj/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo/rpm. But currently when inherit packagefeed-stability class, the deploydir should be /$Prj/tmp/deploy/rpm-prediff, not the default /$Prj/tmp/deploy/rpm. If use /$Prj/tmp/deploy/rpm, then result in the logic as below: os.link("/$Prj/tmp/deploy/rpm-prediff/i586/initscripts-1.0-r155.i586.rpm", "/$Prj/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo/rpm-prediff/i586/initscripts-1.0-r155.i586.rpm") Update to the actual deploydir to guarantee the logic as below: os.link("/$Prj/tmp/deploy/rpm-prediff/i586/initscripts-1.0-r155.i586.rpm", "/$Prj/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/oe-rootfs-repo/rpm/i586/initscripts-1.0-r155.i586.rpm") Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-21oe-selftest: devtool: Support meta being a symbolic linkPeter Kjellerstedt
oe-selftest's devtool tests have been broken since commit 2457cd57 (oe-selftest: devtool: avoid parallel races by using temporary copy of core) if meta is a symbolic link. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18oeqa/core/runner: refactor for OEQA to write json testresultYeoh Ee Peng
Refactor the original _getDetailsNotPassed method to return testresult details (test status and log), which will be reused by future OEQA code to write json testresult. Take the opportunity to consolidate and simplify the logic used to gather test status and log within the TestResult instance. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18package_manager: handle remove() with no packagesRoss Burton
If remove() is called with an empty package list, ensure we do nothing instead of calling the underlying package manager with an invalid command line. [ YOCTO #12900 ] Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-10-18package_manager: implement PACKAGE_EXCLUDE for opkgRoss Burton
opkg has supported the --add-exclude option to install since 0.3.0, so use it to implement support for PACKAGE_EXCLUDE. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18rootfs: possibility to add packages to debug rootfsAndrej Valek
Static libraries are not included in rootfs, it means, that sources are not going into debug rootfs. This option enables to install additional packages even if the standard package is not installed. Signed-off-by: Andrej Valek <andrej.valek@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>