diff options
| -rw-r--r-- | meta-selftest/classes/test_anon_func.bbclass | 3 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 18 |
2 files changed, 21 insertions, 0 deletions
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 @@ | |||
| 1 | python () { | ||
| 2 | d.setVar("TEST_SET_FROM_ANON_FUNC", "expected value") | ||
| 3 | } | ||
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 | |||
| 375 | self.assertGreater(result.status, 0, "Build should have failed if ${ is in the path") | 375 | self.assertGreater(result.status, 0, "Build should have failed if ${ is in the path") |
| 376 | self.assertTrue(re.search("ERROR: Directory name /.* contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution", | 376 | self.assertTrue(re.search("ERROR: Directory name /.* contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution", |
| 377 | result.output), msg = "mkdirhier with unexpanded variable should have failed: %s" % result.output) | 377 | result.output), msg = "mkdirhier with unexpanded variable should have failed: %s" % result.output) |
| 378 | |||
| 379 | def test_bb_env_bb_getvar_equality(self): | ||
| 380 | """ Test if "bitbake -e" output is identical to "bitbake-getvar" output for a variable set from an anonymous function | ||
| 381 | """ | ||
| 382 | self.write_config('''INHERIT += "test_anon_func" | ||
| 383 | TEST_SET_FROM_ANON_FUNC ?= ""''') | ||
| 384 | |||
| 385 | result_bb_e = runCmd('bitbake -e') | ||
| 386 | bb_e_var_match = re.search('^TEST_SET_FROM_ANON_FUNC="(?P<value>.*)"$', result_bb_e.output, re.MULTILINE) | ||
| 387 | self.assertTrue(bb_e_var_match, msg = "Can't find TEST_SET_FROM_ANON_FUNC value in \"bitbake -e\" output") | ||
| 388 | bb_e_var_value = bb_e_var_match.group("value") | ||
| 389 | |||
| 390 | result_bb_getvar = runCmd('bitbake-getvar TEST_SET_FROM_ANON_FUNC --value') | ||
| 391 | bb_getvar_var_value = result_bb_getvar.output.strip() | ||
| 392 | self.assertEqual(bb_e_var_value, bb_getvar_var_value, | ||
| 393 | msg='''"bitbake -e" output differs from bitbake-getvar output for TEST_SET_FROM_ANON_FUNC (set from anonymous function) | ||
| 394 | bitbake -e: "%s" | ||
| 395 | bitbake-getvar: "%s"''' % (bb_e_var_value, bb_getvar_var_value)) | ||
