diff options
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 36 |
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 = """ | ||
118 | VAR_var_override1 = "B" | ||
119 | EXTRA = ":override1" | ||
120 | OVERRIDES = "nothing${EXTRA}" | ||
121 | |||
122 | BBCLASSEXTEND = "###CLASS###" | ||
123 | """ | ||
124 | classextend_bbclass = """ | ||
125 | EXTRA = "" | ||
126 | python () { | ||
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 | |||