diff options
-rw-r--r-- | meta/lib/oeqa/selftest/cases/tinfoil.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/tinfoil.py b/meta/lib/oeqa/selftest/cases/tinfoil.py index 471517fb29..f889a47b26 100644 --- a/meta/lib/oeqa/selftest/cases/tinfoil.py +++ b/meta/lib/oeqa/selftest/cases/tinfoil.py | |||
@@ -195,3 +195,37 @@ class TinfoilTests(OESelftestTestCase): | |||
195 | tinfoil.config_data.appendVar('OVERRIDES', ':overrideone') | 195 | tinfoil.config_data.appendVar('OVERRIDES', ':overrideone') |
196 | value = tinfoil.config_data.getVar('TESTVAR') | 196 | value = tinfoil.config_data.getVar('TESTVAR') |
197 | self.assertEqual(value, 'one', 'Variable overrides not functioning correctly') | 197 | self.assertEqual(value, 'one', 'Variable overrides not functioning correctly') |
198 | |||
199 | def test_variable_history(self): | ||
200 | # Basic test to ensure that variable history works when tracking=True | ||
201 | with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: | ||
202 | tinfoil.prepare(config_only=False, quiet=2) | ||
203 | # Note that _tracking for any datastore we get will be | ||
204 | # false here, that's currently expected - so we can't check | ||
205 | # for that | ||
206 | history = tinfoil.config_data.varhistory.variable('DL_DIR') | ||
207 | for entry in history: | ||
208 | if entry['file'].endswith('/bitbake.conf'): | ||
209 | if entry['op'] in ['set', 'set?']: | ||
210 | break | ||
211 | else: | ||
212 | self.fail('Did not find history entry setting DL_DIR in bitbake.conf. History: %s' % history) | ||
213 | # Check it works for recipes as well | ||
214 | testrecipe = 'zlib' | ||
215 | rd = tinfoil.parse_recipe(testrecipe) | ||
216 | history = rd.varhistory.variable('LICENSE') | ||
217 | bbfound = -1 | ||
218 | recipefound = -1 | ||
219 | for i, entry in enumerate(history): | ||
220 | if entry['file'].endswith('/bitbake.conf'): | ||
221 | if entry['detail'] == 'INVALID' and entry['op'] in ['set', 'set?']: | ||
222 | bbfound = i | ||
223 | elif entry['file'].endswith('.bb'): | ||
224 | if entry['op'] == 'set': | ||
225 | recipefound = i | ||
226 | if bbfound == -1: | ||
227 | self.fail('Did not find history entry setting LICENSE in bitbake.conf parsing %s recipe. History: %s' % (testrecipe, history)) | ||
228 | if recipefound == -1: | ||
229 | self.fail('Did not find history entry setting LICENSE in %s recipe. History: %s' % (testrecipe, history)) | ||
230 | if bbfound > recipefound: | ||
231 | self.fail('History entry setting LICENSE in %s recipe and in bitbake.conf in wrong order. History: %s' % (testrecipe, history)) | ||