summaryrefslogtreecommitdiffstats
path: root/lib/bb/tests
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-22 23:29:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-22 23:33:37 +0100
commit5c4179f58a4e04f1c354df5f17d1860eb403f0ac (patch)
tree0ad5e8997915b0fe4e2e07a9e253c5bf301e1c77 /lib/bb/tests
parent32dff4749c32f32e947c42c86f8357b8b607354b (diff)
downloadbitbake-5c4179f58a4e04f1c354df5f17d1860eb403f0ac.tar.gz
tests/parse: Add BBCLASSEXTEND multiple data store corruption reproducer
One data store changing a variable poked through into a different data store. This test case replicates that issue where the value 'B' would become unset/disappear. We also enhance parsehelper to generate files with an optional suffix such as bbclass. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests')
-rw-r--r--lib/bb/tests/parse.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/bb/tests/parse.py b/lib/bb/tests/parse.py
index 21fd78a73..6beb76a48 100644
--- a/lib/bb/tests/parse.py
+++ b/lib/bb/tests/parse.py
@@ -47,9 +47,9 @@ C = "3"
self.d = bb.data.init()
bb.parse.siggen = bb.siggen.init(self.d)
- def parsehelper(self, content):
+ def parsehelper(self, content, suffix = ".bb"):
- f = tempfile.NamedTemporaryFile(suffix = ".bb")
+ f = tempfile.NamedTemporaryFile(suffix = suffix)
f.write(content)
f.flush()
os.chdir(os.path.dirname(f.name))
@@ -113,3 +113,35 @@ PN = "bc"
d.setVar("OVERRIDES", "bc-dev")
self.assertEqual(d.getVar("DESCRIPTION", True), "C D")
+
+ classextend = """
+VAR_var_override1 = "B"
+EXTRA = ":override1"
+OVERRIDES = "nothing${EXTRA}"
+
+BBCLASSEXTEND = "###CLASS###"
+"""
+ classextend_bbclass = """
+EXTRA = ""
+python () {
+ d.renameVar("VAR_var", "VAR_var2")
+}
+"""
+
+ #
+ # Test based upon a real world data corruption issue. One
+ # data store changing a variable poked through into a different data
+ # store. This test case replicates that issue where the value 'B' would
+ # become unset/disappear.
+ #
+ def test_parse_classextend_contamination(self):
+ cls = self.parsehelper(self.classextend_bbclass, suffix=".bbclass")
+ #clsname = os.path.basename(cls.name).replace(".bbclass", "")
+ self.classextend = self.classextend.replace("###CLASS###", cls.name)
+ f = self.parsehelper(self.classextend)
+ alldata = bb.parse.handle(f.name, self.d)
+ d1 = alldata['']
+ d2 = alldata[cls.name]
+ self.assertEqual(d1.getVar("VAR_var", True), "B")
+ self.assertEqual(d2.getVar("VAR_var", True), None)
+