summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/codeparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests/codeparser.py')
-rw-r--r--bitbake/lib/bb/tests/codeparser.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py
index 826a2d2f6d..f1c4f618d8 100644
--- a/bitbake/lib/bb/tests/codeparser.py
+++ b/bitbake/lib/bb/tests/codeparser.py
@@ -111,9 +111,9 @@ ${D}${libdir}/pkgconfig/*.pc
111 self.assertExecs(set(["sed"])) 111 self.assertExecs(set(["sed"]))
112 112
113 def test_parameter_expansion_modifiers(self): 113 def test_parameter_expansion_modifiers(self):
114 # - and + are also valid modifiers for parameter expansion, but are 114 # -,+ and : are also valid modifiers for parameter expansion, but are
115 # valid characters in bitbake variable names, so are not included here 115 # valid characters in bitbake variable names, so are not included here
116 for i in ('=', ':-', ':=', '?', ':?', ':+', '#', '%', '##', '%%'): 116 for i in ('=', '?', '#', '%', '##', '%%'):
117 name = "foo%sbar" % i 117 name = "foo%sbar" % i
118 self.parseExpression("${%s}" % name) 118 self.parseExpression("${%s}" % name)
119 self.assertNotIn(name, self.references) 119 self.assertNotIn(name, self.references)
@@ -412,6 +412,32 @@ esac
412 # Check final value 412 # Check final value
413 self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['anothervalue', 'yetanothervalue', 'lastone']) 413 self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['anothervalue', 'yetanothervalue', 'lastone'])
414 414
415 def test_contains_vardeps_override_operators(self):
416 # Check override operators handle dependencies correctly with the contains functionality
417 expr_plain = 'testval'
418 expr_prepend = '${@bb.utils.filter("TESTVAR1", "testval1", d)} '
419 expr_append = ' ${@bb.utils.filter("TESTVAR2", "testval2", d)}'
420 expr_remove = '${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}'
421 # Check dependencies
422 self.d.setVar('ANOTHERVAR', expr_plain)
423 self.d.prependVar('ANOTHERVAR', expr_prepend)
424 self.d.appendVar('ANOTHERVAR', expr_append)
425 self.d.setVar('ANOTHERVAR:remove', expr_remove)
426 self.d.setVar('TESTVAR1', 'blah')
427 self.d.setVar('TESTVAR2', 'testval2')
428 self.d.setVar('TESTVAR3', 'no-testval')
429 deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), self.d)
430 self.assertEqual(sorted(values.splitlines()),
431 sorted([
432 expr_prepend + expr_plain + expr_append,
433 '_remove of ' + expr_remove,
434 'TESTVAR1{testval1} = Unset',
435 'TESTVAR2{testval2} = Set',
436 'TESTVAR3{no-testval} = Set',
437 ]))
438 # Check final value
439 self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval2'])
440
415 #Currently no wildcard support 441 #Currently no wildcard support
416 #def test_vardeps_wildcards(self): 442 #def test_vardeps_wildcards(self):
417 # self.d.setVar("oe_libinstall", "echo test") 443 # self.d.setVar("oe_libinstall", "echo test")