]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: bb.tests.codeparser: add parameter expansion modifiers test
authorChristopher Larson <chris_larson@mentor.com>
Fri, 18 Jan 2019 16:45:55 +0000 (21:45 +0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 21 Jan 2019 23:44:34 +0000 (23:44 +0000)
We don't want references including shell parameter expansion modifiers
(i.e. `:-`, `#`, `%%`, etc) to be added to our vardeps, so add a test to
ensure this.

YOCTO #12987

(Bitbake rev: be022085fe1ea1b9a9d519f0455883e2da363d2c)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/tests/codeparser.py

index e30e78c1580f7921aac6ba843abfad544e87f31e..3fd76a8f9f0bb2837f6d89bafbcac9ca1691bbd5 100644 (file)
@@ -123,6 +123,13 @@ ${D}${libdir}/pkgconfig/*.pc
         self.parseExpression("sed -i -e 's:IP{:I${:g' $pc")
         self.assertExecs(set(["sed"]))
 
+    def test_parameter_expansion_modifiers(self):
+        # - and + are also valid modifiers for parameter expansion, but are
+        # valid characters in bitbake variable names, so are not included here
+        for i in ('=', ':-', ':=', '?', ':?', ':+', '#', '%', '##', '%%'):
+            name = "foo%sbar" % i
+            self.parseExpression("${%s}" % name)
+            self.assertNotIn(name, self.references)
 
     def test_until(self):
         self.parseExpression("until false; do echo true; done")