summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
authorChristopher Larson <kergoth@gmail.com>2022-03-17 15:33:54 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-04 11:37:55 +0100
commitfc8468024cf47cb7019e0167e7e07f24131c85b1 (patch)
treea1633dfbe6e06f2e496dcb315cdf20dfb782a140 /bitbake/lib/bb/tests
parent6f361c81bae78f1c36faae3f01edce93cd8af957 (diff)
downloadpoky-fc8468024cf47cb7019e0167e7e07f24131c85b1.tar.gz
bitbake: tests.data: add test for inline python calling a def'd function
This is a test for an issue seen long ago, to avoid regressions, where a reference to a def'd function in the metadata would return the string value from the metadata rather than the function in inline python. (Bitbake rev: 9f7cb22febd557817c164e25a93f5660e9c06358) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/data.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
index 8c043b709d..251130b857 100644
--- a/bitbake/lib/bb/tests/data.py
+++ b/bitbake/lib/bb/tests/data.py
@@ -77,6 +77,15 @@ class DataExpansions(unittest.TestCase):
77 val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}") 77 val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}")
78 self.assertEqual(str(val), "value_of_foo value_of_bar") 78 self.assertEqual(str(val), "value_of_foo value_of_bar")
79 79
80 def test_python_snippet_function_reference(self):
81 self.d.setVar("TESTVAL", "testvalue")
82 self.d.setVar("testfunc", 'd.getVar("TESTVAL")')
83 self.d.setVarFlag("testfunc", "func", "1")
84 context = bb.utils.get_context()
85 context["testfunc"] = lambda d: d.getVar("TESTVAL")
86 val = self.d.expand("${@testfunc(d)}")
87 self.assertEqual(str(val), "testvalue")
88
80 def test_python_unexpanded(self): 89 def test_python_unexpanded(self):
81 self.d.setVar("bar", "${unsetvar}") 90 self.d.setVar("bar", "${unsetvar}")
82 val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}") 91 val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}")