summaryrefslogtreecommitdiffstats
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-23 08:48:41 +0100
commitaaea533e70d4aefc2de3a2a62a3453a2a9034292 (patch)
treeb74a9d7908565d4c9497d1eaf988e76d076fdb3f
parent19f290f223376cc9428a1b8fc08476dc76b578ee (diff)
downloadpoky-aaea533e70d4aefc2de3a2a62a3453a2a9034292.tar.gz
bitbake: 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. (Bitbake rev: 5c4179f58a4e04f1c354df5f17d1860eb403f0ac) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/tests/parse.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py
index 21fd78a736..6beb76a48d 100644
--- a/bitbake/lib/bb/tests/parse.py
+++ b/bitbake/lib/bb/tests/parse.py
@@ -47,9 +47,9 @@ C = "3"
47 self.d = bb.data.init() 47 self.d = bb.data.init()
48 bb.parse.siggen = bb.siggen.init(self.d) 48 bb.parse.siggen = bb.siggen.init(self.d)
49 49
50 def parsehelper(self, content): 50 def parsehelper(self, content, suffix = ".bb"):
51 51
52 f = tempfile.NamedTemporaryFile(suffix = ".bb") 52 f = tempfile.NamedTemporaryFile(suffix = suffix)
53 f.write(content) 53 f.write(content)
54 f.flush() 54 f.flush()
55 os.chdir(os.path.dirname(f.name)) 55 os.chdir(os.path.dirname(f.name))
@@ -113,3 +113,35 @@ PN = "bc"
113 d.setVar("OVERRIDES", "bc-dev") 113 d.setVar("OVERRIDES", "bc-dev")
114 self.assertEqual(d.getVar("DESCRIPTION", True), "C D") 114 self.assertEqual(d.getVar("DESCRIPTION", True), "C D")
115 115
116
117 classextend = """
118VAR_var_override1 = "B"
119EXTRA = ":override1"
120OVERRIDES = "nothing${EXTRA}"
121
122BBCLASSEXTEND = "###CLASS###"
123"""
124 classextend_bbclass = """
125EXTRA = ""
126python () {
127 d.renameVar("VAR_var", "VAR_var2")
128}
129"""
130
131 #
132 # Test based upon a real world data corruption issue. One
133 # data store changing a variable poked through into a different data
134 # store. This test case replicates that issue where the value 'B' would
135 # become unset/disappear.
136 #
137 def test_parse_classextend_contamination(self):
138 cls = self.parsehelper(self.classextend_bbclass, suffix=".bbclass")
139 #clsname = os.path.basename(cls.name).replace(".bbclass", "")
140 self.classextend = self.classextend.replace("###CLASS###", cls.name)
141 f = self.parsehelper(self.classextend)
142 alldata = bb.parse.handle(f.name, self.d)
143 d1 = alldata['']
144 d2 = alldata[cls.name]
145 self.assertEqual(d1.getVar("VAR_var", True), "B")
146 self.assertEqual(d2.getVar("VAR_var", True), None)
147