diff options
author | Andrew Geissler <geissonator@yahoo.com> | 2020-04-13 21:39:40 +0300 |
---|---|---|
committer | Andrew Geissler <geissonator@yahoo.com> | 2020-05-05 16:30:44 +0300 |
commit | 82c905dc58a36aeae40b1b273a12f63fb1973cf4 (patch) | |
tree | 38caf00263451b5036435cdc36e035b25d32e623 /poky/bitbake/lib/bb/tests/utils.py | |
parent | 83ecb75644b3d677c274188f9ac0b2374d6f6925 (diff) | |
download | openbmc-82c905dc58a36aeae40b1b273a12f63fb1973cf4.tar.xz |
meta-openembedded and poky: subtree updates
Squash of the following due to dependencies among them
and OpenBMC changes:
meta-openembedded: subtree update:d0748372d2..9201611135
meta-openembedded: subtree update:9201611135..17fd382f34
poky: subtree update:9052e5b32a..2e11d97b6c
poky: subtree update:2e11d97b6c..a8544811d7
The change log was too large for the jenkins plugin
to handle therefore it has been removed. Here is
the first and last commit of each subtree:
meta-openembedded:d0748372d2
cppzmq: bump to version 4.6.0
meta-openembedded:17fd382f34
mpv: Remove X11 dependency
poky:9052e5b32a
package_ipk: Remove pointless comment to trigger rebuild
poky:a8544811d7
pbzip2: Fix license warning
Change-Id: If0fc6c37629642ee207a4ca2f7aa501a2c673cd6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'poky/bitbake/lib/bb/tests/utils.py')
-rw-r--r-- | poky/bitbake/lib/bb/tests/utils.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/poky/bitbake/lib/bb/tests/utils.py b/poky/bitbake/lib/bb/tests/utils.py index 5c910b4b8..a7ff33db5 100644 --- a/poky/bitbake/lib/bb/tests/utils.py +++ b/poky/bitbake/lib/bb/tests/utils.py @@ -622,3 +622,47 @@ BBLAYERS += "/home/user/otherpath/layer6" ['/home/user/otherpath/layer6', '/home/user/path/layer3'], ['/home/user/path/layer1', '/home/user/path/layer4', '/home/user/path/layer7'], ['/home/user/path/layer3'], ['/home/user/path/layer7']) + + +class GetReferencedVars(unittest.TestCase): + def setUp(self): + self.d = bb.data.init() + + def check_referenced(self, expression, expected_layers): + vars = bb.utils.get_referenced_vars(expression, self.d) + + # Do the easy check first - is every variable accounted for? + expected_vars = set.union(set(), *expected_layers) + got_vars = set(vars) + self.assertSetEqual(got_vars, expected_vars) + + # Now test the order of the layers + start = 0 + for i, expected_layer in enumerate(expected_layers): + got_layer = set(vars[start:len(expected_layer)+start]) + start += len(expected_layer) + self.assertSetEqual(got_layer, expected_layer) + + def test_no_vars(self): + self.check_referenced("", []) + self.check_referenced(" ", []) + self.check_referenced(" no vars here! ", []) + + def test_single_layer(self): + self.check_referenced("${VAR}", [{"VAR"}]) + self.check_referenced("${VAR} ${VAR}", [{"VAR"}]) + + def test_two_layer(self): + self.d.setVar("VAR", "${B}") + self.check_referenced("${VAR}", [{"VAR"}, {"B"}]) + self.check_referenced("${@d.getVar('VAR')}", [{"VAR"}, {"B"}]) + + def test_more_complicated(self): + self.d["SRC_URI"] = "${QT_GIT}/${QT_MODULE}.git;name=${QT_MODULE};${QT_MODULE_BRANCH_PARAM};protocol=${QT_GIT_PROTOCOL}" + self.d["QT_GIT"] = "git://code.qt.io/${QT_GIT_PROJECT}" + self.d["QT_MODULE_BRANCH_PARAM"] = "branch=${QT_MODULE_BRANCH}" + self.d["QT_MODULE"] = "${BPN}" + self.d["BPN"] = "something to do with ${PN} and ${SPECIAL_PKGSUFFIX}" + + layers = [{"SRC_URI"}, {"QT_GIT", "QT_MODULE", "QT_MODULE_BRANCH_PARAM", "QT_GIT_PROTOCOL"}, {"QT_GIT_PROJECT", "QT_MODULE_BRANCH", "BPN"}, {"PN", "SPECIAL_PKGSUFFIX"}] + self.check_referenced("${SRC_URI}", layers) |