From: Yoann Congal <yoann.con...@smile.fr> This is a non-regression test for [YOCTO #15638]
Signed-off-by: Yoann Congal <yoann.con...@smile.fr> --- NB: This test currently fails on master, it needs the fix that was just sent to the bitbake ML: [PATCH 1/2] tinfoil: add new "finalizeData" API https://lists.openembedded.org/g/bitbake-devel/topic/patch_1_2_tinfoil_add_new/109545383 [PATCH 2/2] bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e" https://lists.openembedded.org/g/bitbake-devel/topic/patch_2_2_bitbake_getvar/109545384 --- meta-selftest/classes/test_anon_func.bbclass | 3 +++ meta/lib/oeqa/selftest/cases/bbtests.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 meta-selftest/classes/test_anon_func.bbclass diff --git a/meta-selftest/classes/test_anon_func.bbclass b/meta-selftest/classes/test_anon_func.bbclass new file mode 100644 index 0000000000..b1197dc7a4 --- /dev/null +++ b/meta-selftest/classes/test_anon_func.bbclass @@ -0,0 +1,3 @@ +python () { + d.setVar("TEST_SET_FROM_ANON_FUNC", "expected value") +} diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 98e9f81661..1cec77b72c 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py @@ -375,3 +375,21 @@ require conf/distro/include/no-gplv3.inc self.assertGreater(result.status, 0, "Build should have failed if ${ is in the path") self.assertTrue(re.search("ERROR: Directory name /.* contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution", result.output), msg = "mkdirhier with unexpanded variable should have failed: %s" % result.output) + + def test_bb_env_bb_getvar_equality(self): + """ Test if "bitbake -e" output is identical to "bitbake-getvar" output for a variable set from an anonymous function + """ + self.write_config('''INHERIT += "test_anon_func" +TEST_SET_FROM_ANON_FUNC ?= ""''') + + result_bb_e = runCmd('bitbake -e') + bb_e_var_match = re.search('^TEST_SET_FROM_ANON_FUNC="(?P<value>.*)"$', result_bb_e.output, re.MULTILINE) + self.assertTrue(bb_e_var_match, msg = "Can't find TEST_SET_FROM_ANON_FUNC value in \"bitbake -e\" output") + bb_e_var_value = bb_e_var_match.group("value") + + result_bb_getvar = runCmd('bitbake-getvar TEST_SET_FROM_ANON_FUNC --value') + bb_getvar_var_value = result_bb_getvar.output.strip() + self.assertEqual(bb_e_var_value, bb_getvar_var_value, + msg='''"bitbake -e" output differs from bitbake-getvar output for TEST_SET_FROM_ANON_FUNC (set from anonymous function) +bitbake -e: "%s" +bitbake-getvar: "%s"''' % (bb_e_var_value, bb_getvar_var_value))
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#207069): https://lists.openembedded.org/g/openembedded-core/message/207069 Mute This Topic: https://lists.openembedded.org/mt/109545469/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-