summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/data.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: data_smart: Ensure _remove operations on newly set variables are ↵Richard Purdie2017-04-121-0/+6
| | | | | | | | | | | | | | | | cleared We clear append/prepend on newly set variables, we should also clear remove operations. If we don't do this, there is no way we can actually delete a remove operation. Bitbake internally uses parsing=True to avoid these side effects when making its own internal calls. Also add a testcase to bitbake-selftest to ensure we remain consistent going forward from here. (Bitbake rev: 3a319f079d699c870d8531e051ab65e6278d1fa5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: implement missing remote datastore operationsPaul Eggleton2017-03-221-18/+110
| | | | | | | | | | | | | | | | | | | | | | | | Enable the following operations from a remote datastore to affect the other end: * setVarFlag() * delVar() * delVarFlag() * renameVar() In practice I don't expect these to be used much, but they should be present so that the implementation is at least reasonably filled out and that the tests pass. Also add tests for the interface, mostly by subclassing the existing local test classes so that they are using a remote datastore. (These don't actually test remote usage via tinfoil, just that the datastore's interface can be used.) (Bitbake rev: 282dc0719d22a39df746eea762ebe05c66aa8f8a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tinfoil: fix override handling in remote datastoresPaul Eggleton2017-03-221-0/+4
| | | | | | | | | | | | | | | | | | | There was a huge gap in the remote datastore code introduced in the tinfoil2 rework - we weren't handling overrides at all, since these are stored separately from the actual data in the DataSmart object. Thus, when a datastore actually represents a remote datastore we need to go back to that remote datastore to get the override data as well, so introduce code to do that. To avoid a second round-trip I had to modify the _findVar() function to return the override data as well. This will increase the overhead a little when that data is superfluous, but without making the function even uglier I don't think there's a way to avoid that. (Bitbake rev: 4f9d6f060ed247fb6fa2f45668a892a1788d3f91) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Add inactive remove override testRichard Purdie2017-03-161-0/+7
| | | | | | | | | | In 2bc4d35fb32defc59cd6ed1fc87e35924c201a5c we fixed cases where an inactive remove override was influecing the value of a variable. This adds a test case for this issue. (Bitbake rev: 1ff9b3c669fa187f152de7b8b57d14c2468d926c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: Drop now unneeded update_data callsRichard Purdie2017-02-151-17/+1
| | | | | | | | | | Now that the datastore works dynamically we don't need the update_data calls so we can just remove them. They're not actually done anything at all for a while. (Bitbake rev: 2300beb50333bb620013b058a7309e7f2042101d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove True option to getVar calls (take 2)Joshua Lock2016-12-161-1/+1
| | | | | | | | | | | | | | | getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (a follow on patch to fix up a few recent introductions) (Bitbake rev: f9961fd5beb31d5ab9656a5be59f7ab3effef2f0) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: support serialisationPaul Eggleton2016-12-141-0/+23
| | | | | | | | | | | | | The COW object used within VariableHistory can't be serialised itself, but we can convert it to a dict when serializing and then back when deserialising. This finally allows DataSmart objects to be serialized. NOTE: "serialisation" here means pickling, not over XMLRPC or any other transport. (Bitbake rev: bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tinfoil: pass datastore to server when expanding python referencesPaul Eggleton2016-12-141-2/+8
| | | | | | | | | | | | | | | | | | | | If you're expanding a value that refers to the value of a variable in python code, we need to ensure that the datastore that gets used to get the value of that variable is the client-side datastore and not just the part of it that's on the server side. For example, suppose you are in client code doing the following: d.setVar('HELLO', 'there') result = d.expand('${@d.getVar("HELLO", True)}') result should be "there" but if the client part wasn't taken into account, it would be whatever value HELLO had in the server portion of the datastore (if any). (Bitbake rev: cbc22a0a9aadc8606b927dbac0f1407ec2736b35) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: implement remote datastore functionalityPaul Eggleton2016-12-141-0/+39
| | | | | | | | | | | | | | | | | This allows you to maintain a local reference to a remote datastore. The actual implementation of the remote connection is delegated to a connector object that the caller must define and supply. There is support for getting variable values and expanding python references (i.e. ${@...} remotely, however setting variables remotely is not supported - any variable setting is done locally as if the datastore were a copy (which it kind of is). Loosely based on an earlier prototype implementation by Qing He. (Bitbake rev: a3edc3eefa2d03c4ad5d12187b32fa4dc495082a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove True option to getVar callsJoshua Lock2016-11-301-29/+29
| | | | | | | | | | | | getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (Bitbake rev: 3b45c479de8640f92dd1d9f147b02e1eecfaadc8) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-6/+6
| | | | | | | | | Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb: Add expansion parameter to getVarFlagRichard Purdie2016-02-041-4/+4
| | | | | | | | | | | | | | | This sets the scene for removing the default False for expansion from getVarFlag. This would later allow True to become the expand default. On the most part this is an automatic translation with: sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i `grep -ril getVar *` There should be no functional change from this patch. (Bitbake rev: 7c3b99c6a716095af3ffce0b15110e91fb49c913) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: Don't show exceptions for EOL literalsRichard Purdie2016-01-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If variables are unset, the code simply doesn't expand them, there aren't errors. If the code is a python expression, this can get a bit messy, see the attached test case. The python expansion code sees the } of the unexpanded value rather than the close of the python expression and then raises a SyntaxError exception. Ideally, we'd update the code to match pairs of brackets. I don't know how to do that with the current regex and this is unfortunately a performance sensitive piece of code. We also run the risk of breaking existing code in OE-Core where there are "{" characters but not "}" to close them (PKGE and PE). Rather than raising the exception, matching the existing "just return the expression" behaviour seems more consistent with the standard variable behaviour. This addresses an issue found in the recent image.bbclass code where there are some variables we choose not to expand (TMPDIR/DATETIME). This patch also adds a test case for this behaviour. It wouldn't preclude improved bracket matching code in the future either. (Bitbake rev: d80d39e73223a50fda0090784303d2c57167bb4c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Add new data testsRichard Purdie2015-07-121-0/+47
| | | | | | | | | Add a variety of tests which were found to be useful when working on the data store recently. (Bitbake rev: 5c5f8da509f6bbc1fad263462142519ef3d54a35) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Add explict getVar param for (non) expansionRichard Purdie2015-06-231-9/+9
| | | | | | | | | | | | | | Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` (Bitbake rev: 659ef95c9b8aced3c4ded81c48bcc0fbde4d429f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Add key expansion unit testRichard Purdie2015-05-291-0/+14
| | | | | | | | | This ensures basic key expansion works and that overlapping keys generate a log message. (Bitbake rev: ed5a8954ac923eda9750a636c5bb5b95ffce664f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Add log parsing test codeRichard Purdie2015-05-291-1/+24
| | | | | | | | | This allows us to write tests which ensure a particular action generates a particular log message. (Bitbake rev: b30ee0aba51a35a194a4338b988f93ece1ed281c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: add test for incorrect remove behaviourRoss Burton2015-02-031-0/+7
| | | | | | | | | | The _remove operator isn't working correctly when used with a variable that expands to several items, so add a test case to exercise this path. (Bitbake rev: cb2a62a5fbffb358528a85b46c1fc6383286cb9d) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Add a key deletion testRichard Purdie2014-12-251-0/+6
| | | | | | | | | If you copy the datastore, then delete a key, it should not exist in d.keys(). This adds a test to cover the recently found data store bug. (Bitbake rev: 16d5f40ad20fd08bf7a4d0e36200c739b5a9f59e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: Fix remove operator and its interaction with data expansionRichard Purdie2014-09-131-0/+7
| | | | | | | | | | | | | | | | | | | If you have: FOO = "${bindir}/X Y" FOO_remove = "${bindir}/X" the expected result is "Y". Currently this doesn't work since the removed expressions are not expanded first. This patch adjusts things so the expressions are expanded before being processed for removal. Also add a test to ensure this case continues to work. [YOCTO #6624] (Bitbake rev: 72a1ca4a104ccab73d6abcbd44db9c2636a58572) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bb/tests/data.py: add tests for contains() and contains_any()Ross Burton2014-06-121-0/+36
| | | | | | | | | contains_any is buggy so write a test case to demonstrate this. (Bitbake rev: 25d10c349aab77bf99745c0a90dd8f9b90abccac) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: Fix an unusual variable reference bugRichard Purdie2014-05-211-0/+5
| | | | | | | | | | | | | | | | | | | | If you try: Y = "" Y_remove = "X" in OE-Core, bitbake will crash with a KeyError during expansion. The reason is that no expansion of the empty value is attempted but removal from is it and hence no varparse data is present for it in the expand_cache. If the value is empty, there is nothing to remove so the best fix is simply not to check for None but check it has any value. Also add a test for this error so it doesn't get reintroduced. (Bitbake rev: af3ce0fc0280e6642fa35de400f75fdbabf329b1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: test/data: Add in test for append/prepend/remove override operationsRichard Purdie2014-03-251-0/+41
| | | | | | | | | | We currently don't have test cases for _append, _prepend and _remove. This patch adds some basic tests and includes a test case for a recently reported issue with the _remove operator. (Bitbake rev: 93291bd90e18808c7a1c8c692949396bbc7e4348) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests: add missing importPaul Eggleton2014-02-281-0/+1
| | | | | | | | | This was found when trying to run the data tests individually. (Bitbake rev: e4bf4ad4b99978483541a719105c98ea124e8a34) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/data: Whitespace in key names is a really bad ideaRichard Purdie2013-09-221-15/+15
| | | | | | | | | | | | | The parser never has supported it, the datastore API did happen to work but whitespace in key names is a really bad idea and not something I think we should encourage or support. Fix test case failures after excplitly ignoring it for variable expansion purposes. (Bitbake rev: a2074ddaba6f53962d6caf34dbd27bdbc259935b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: Add editor modelines for bb.tests.*Olof Johansson2013-02-171-0/+2
| | | | | | | (Bitbake rev: 230e00948ba093958e8e89e9ee380444b3dad307) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Add start of bitbake regression/self testingRichard Purdie2012-05-041-0/+252
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>