summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-08-31 11:54:16 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 23:30:02 +0100
commite3ccf049021909f593a935ca3782718e0e2387fb (patch)
tree739d28ba081afe582465279c21e6e8eba088276a /meta/lib/oeqa
parentab846047bc79a367ab5aa249b396e0ab76f0ae51 (diff)
downloadpoky-e3ccf049021909f593a935ca3782718e0e2387fb.tar.gz
oe-selftest: tinfoil: add a test for variable history
I recently found that variable history wasn't working properly for recipes when we enable history tracking, resulting in minor functionality loss in devtool upgrade, so add a test to ensure this doesn't regress now that it's fixed. (From OE-Core rev: f49042e707d641b59a71c687374b76df97c64c34) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/tinfoil.py34
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))