summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/utils.py
AgeCommit message (Collapse)Author
2020-01-19bitbake: tests/utils: add tests for bb.utils.get_referenced_varsChris Laplante via bitbake-devel
(Bitbake rev: 346e74e5d751aadf7881de70b5ab6670dfc463ce) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-21bitbake: tests: add test for the hashing functionsRoss Burton
Add a basic test for bb.utils.md5_file() etc. (Bitbake rev: e944d02fe678f7c6b05c62419f8bceb0709f3037) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-21bitbake: tests/utils.py: add one more test cases for bb.utils.vercmp_stringMartin Jansa
* this is just another test case for issue already fixed in: commit fef56d28c3efec4876c379898cbc4d4c65303aee Author: Alexander Kanavin <alex.kanavin@gmail.com> Date: Sun Feb 24 21:07:28 2019 +0100 Subject: bitbake: fix version comparison when one of the versions ends in . * The TypeError is triggered not by '.' at the end, but from the extra numberic component in one of the versions. * When one version has fewer elements, it's extended by another (0, None) element where 0 means numeric component. Then the result cannot be decided by comparing the types (oa < ob, ob > oa) and it continues to compare values (ca < cb) which fails when one of them is the None from (0, None) appended before. ====================================================================== ERROR: test_vercmpstring (bb.tests.utils.VerCmpString) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/bb/tests/utils.py", line 32, in test_vercmpstring result = bb.utils.vercmp_string('1a', '1a1') File "lib/bb/utils.py", line 131, in vercmp_string return vercmp(ta, tb) File "lib/bb/utils.py", line 123, in vercmp r = vercmp_part(va, vb) File "lib/bb/utils.py", line 112, in vercmp_part elif ca < cb: TypeError: '<' not supported between instances of 'NoneType' and 'int' ---------------------------------------------------------------------- Ran 3 tests in 0.002s (Bitbake rev: 9767fffe3115a1f1afa3c6a2b39720fefb8dc4d5) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Strip old editor directives from file headersRichard Purdie
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. (Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. (Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. (Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25bitbake: bitbake: fix version comparison when one of the versions ends in .Alexander Kanavin
Previously, this would happen: ====================================================================== ERROR: test_vercmpstring (bb.tests.utils.VerCmpString) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alexander/development/poky/bitbake/lib/bb/tests/utils.py", line 45, in test_vercmpstring result = bb.utils.vercmp_string('1.', '1.1') File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 143, in vercmp_string return vercmp(ta, tb) File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 135, in vercmp r = vercmp_part(va, vb) File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 124, in vercmp_part elif ca < cb: TypeError: '<' not supported between instances of 'NoneType' and 'int' ---------------------------------------------------------------------- (Bitbake rev: fef56d28c3efec4876c379898cbc4d4c65303aee) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-09bitbake: tests/utils.py: test origvalue in a callback matches what is expectedRandy Witt
There were no tests that verified the value of origvalue in the callback routines used by edit_metadata(). This patch adds one for a simple multiline variable. (Bitbake rev: ece3a4d02d8162dee78c2062c10291b5fd625c36) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-09bitbake: lib/bb/utils.py: Fix a bug in edit_metadata() that could corrupt varsRandy Witt
edit_metadata() would corrupt a variable that was multiline, but had the ending quotes on the same line as the last value. For example: TEST_VAR = " foo \ bar" would become " foo ba" because the code would always delete the last character on the line and then do it again if the line ended in the quote. This however doesn't show up if you have: TEST_VAR = " foo \ bar \ " which is how all the test cases were written. This patch fixes that bug and adds and fixes a test that matched the bugs behavior rather than the expected behavior. (Bitbake rev: 14f05cbdc2ad8d59a94af1c8816567d93c39c88c) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-07bitbake: lib/bb/utils: improve edit_bblayers_conf() handling of ↵Paul Eggleton
bblayers.conf formatting Make the following improvements to edit_bblayers_conf(): * Support ~ in BBLAYERS entries * Handle where BBLAYERS items are added over multiple lines with += instead of one single long item Also add some comments documenting the function arguments and return values as well as a set of bitbake-selftest tests. (This function is used by the bitbake-layers add, remove and layerindex-fetch subcommands, as well as devtool when adding the workspace layer). (Bitbake rev: e9a0858023c7671e30cc8ebb08496304b7f26b31) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-19bitbake: lib/bb/utils: fix and extend edit_metadata_file()Paul Eggleton
Fix several bugs and add some useful enhancements to make this into a more generic metadata editing function: * Support modifying function values (name must be specified ending with "()") * Support dropping values by returning None as the new value * Split out edit_metadata() function to provide same functionality on a list/iterable * Pass operation to callback and allow function to return them * Pass current output lines to callback so they can be modified * Fix handling of single-quoted values * Handle :=, =+, .=, and =. operators * Support arbitrary indent string * Support indenting by length of assignment (by specifying -1) * Fix typo in variablename - intentspc -> indentspc * Expand function docstring to cover arguments / usage * Add a parameter to enable matching names with overrides applied * Add some bitbake-selftest tests Note that this does change the expected signature of the callback function. The only known caller is in lib/bb/utils.py itself; I doubt anyone else has made extensive use of this function yet. (Bitbake rev: 20059e4d5ab9bf0f32c781ccb208da3c95818018) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-19bitbake: lib/bb/utils: add safeguard against recursively deleting things we ↵Paul Eggleton
shouldn't Add some very basic safeguard against recursively deleting paths such as / and /home in the event of bugs or user mistakes. Addresses [YOCTO #7620]. (Bitbake rev: 56cddeb9e1e4d249f84ccd6ef65db245636e38ea) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-16bitbake: cooker: rework LAYERDEPENDS versioning so that it is actually usefulPaul Eggleton
We've had versioned dependency support in LAYERDEPENDS for quite a long time, but I can say with pretty good certainty that almost nobody has used it up to now because it was too strict - the specified version had to exactly match the version in your configuration or you would get an error; there was no "greater than or equal" option, which is usually what you will want given that LAYERVERSION does get bumped from time to time. However, users mismatching layer branches and then having their builds fail later on with some incomprehensible error is still a pretty common problem. We can't simply use the git branch because not everyone is always on a branch and the branch names don't always match up (and that's not an issue). To provide a practical means to address branch mismatching, I have reworked LAYERDEPENDS version specifications to use the more familiar "dependency (>= version)" syntax as used with package dependencies, support non-integer versions, and clarified the error message a little. If we then take care to bump the version on every breaking change, it is at least possible to have layers depend on these changes when they update to match; we can now even support a major.minor scheme to allow retrospectively adding a version limiter to old branches when a new branch is created and yet still allow the old branch minor version to be bumped if needed. Fixes [YOCTO #5991]. (Bitbake rev: 408be9cdf2b1e32e64ea488d8051a546fb54c144) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-16bitbake: tests: add tests for OE pre-release version formattingPaul Eggleton
This scheme is used for versioning recipes that are pre-release (alpha, beta, etc.) within OpenEmbedded, so add some tests to ensure the appropriate comparison results still hold true. (Bitbake rev: 3a9eefe27f29a4593d6298f0427ac5f3e9183377) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17bitbake: fetch2: Add editor modelines for bb.tests.*Olof Johansson
(Bitbake rev: 230e00948ba093958e8e89e9ee380444b3dad307) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-02bitbake: tests/utils: Add test for explode_dep_versions2Richard Purdie
(Bitbake rev: b1b0aabfab3c94c3b515070d0fb4d7819e2548bc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-04bitbake: Add start of bitbake regression/self testingRichard Purdie
This adds some basic unit testing for the codeparser and data store code. Many of the actual test cases were taken from work by Chris Larson's OE-Signatures work but with changes to adapt to the current bitbake APIs we need to test. I also imported CoW tests written by Holger Freyther from the original bitbake-test codebase: http://svn.berlios.de/wsvn/bitbake/trunk/bitbake-tests/tests/ and some tests from the doctests that were removed in commit: http://git.openembedded.org/bitbake/commit?id=3a11c2807972bbbddffde2fa67fc380d159da467 (Bitbake rev: ae4a95780e3e08cf73c854efa8cd93379e00c4e5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>