mirror of
https://git.yoctoproject.org/poky
synced 2026-03-06 15:29:40 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
ab846047bc
commit
e3ccf04902
@@ -195,3 +195,37 @@ class TinfoilTests(OESelftestTestCase):
|
||||
tinfoil.config_data.appendVar('OVERRIDES', ':overrideone')
|
||||
value = tinfoil.config_data.getVar('TESTVAR')
|
||||
self.assertEqual(value, 'one', 'Variable overrides not functioning correctly')
|
||||
|
||||
def test_variable_history(self):
|
||||
# Basic test to ensure that variable history works when tracking=True
|
||||
with bb.tinfoil.Tinfoil(tracking=True) as tinfoil:
|
||||
tinfoil.prepare(config_only=False, quiet=2)
|
||||
# Note that _tracking for any datastore we get will be
|
||||
# false here, that's currently expected - so we can't check
|
||||
# for that
|
||||
history = tinfoil.config_data.varhistory.variable('DL_DIR')
|
||||
for entry in history:
|
||||
if entry['file'].endswith('/bitbake.conf'):
|
||||
if entry['op'] in ['set', 'set?']:
|
||||
break
|
||||
else:
|
||||
self.fail('Did not find history entry setting DL_DIR in bitbake.conf. History: %s' % history)
|
||||
# Check it works for recipes as well
|
||||
testrecipe = 'zlib'
|
||||
rd = tinfoil.parse_recipe(testrecipe)
|
||||
history = rd.varhistory.variable('LICENSE')
|
||||
bbfound = -1
|
||||
recipefound = -1
|
||||
for i, entry in enumerate(history):
|
||||
if entry['file'].endswith('/bitbake.conf'):
|
||||
if entry['detail'] == 'INVALID' and entry['op'] in ['set', 'set?']:
|
||||
bbfound = i
|
||||
elif entry['file'].endswith('.bb'):
|
||||
if entry['op'] == 'set':
|
||||
recipefound = i
|
||||
if bbfound == -1:
|
||||
self.fail('Did not find history entry setting LICENSE in bitbake.conf parsing %s recipe. History: %s' % (testrecipe, history))
|
||||
if recipefound == -1:
|
||||
self.fail('Did not find history entry setting LICENSE in %s recipe. History: %s' % (testrecipe, history))
|
||||
if bbfound > recipefound:
|
||||
self.fail('History entry setting LICENSE in %s recipe and in bitbake.conf in wrong order. History: %s' % (testrecipe, history))
|
||||
|
||||
Reference in New Issue
Block a user