summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-03-20 17:16:19 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-22 11:35:21 +0000
commit258f98a27c897b08c0b706cc3d85469bff99b2d0 (patch)
tree5f6af02b9eaa44b9520f09f5e42c4f5dae965237 /meta
parentaf994bfcfddb2e17d9adc13fd13870731c5ee6c7 (diff)
downloadpoky-258f98a27c897b08c0b706cc3d85469bff99b2d0.tar.gz
oe-selftest: tinfoil: add tests for recently enabled datastore operations
A recent patch to bitbake fixes these datastore operations so that they actually affect the server end, so we should test that they work. (For full disclosure, some of these tests would probably pass without those fixes, since the operation would be done on the client side instead - but we are at least exercising the code paths.) (From OE-Core rev: 4eb3c705b9cadccacdb191ae89f5242a00f397f3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/tinfoil.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/tinfoil.py b/meta/lib/oeqa/selftest/tinfoil.py
index 38ec7a3bc5..73a0c3bac0 100644
--- a/meta/lib/oeqa/selftest/tinfoil.py
+++ b/meta/lib/oeqa/selftest/tinfoil.py
@@ -153,3 +153,38 @@ class TinfoilTests(oeSelfTest):
153 value = tinfoil.run_command('getVariable', 'TESTVAR') 153 value = tinfoil.run_command('getVariable', 'TESTVAR')
154 self.assertEqual(value, 'specialvalue', 'Value set using config_data.setVar() is not reflected in config_data.getVar()') 154 self.assertEqual(value, 'specialvalue', 'Value set using config_data.setVar() is not reflected in config_data.getVar()')
155 155
156 def test_datastore_operations(self):
157 with bb.tinfoil.Tinfoil() as tinfoil:
158 tinfoil.prepare(config_only=True)
159 # Test setVarFlag() / getVarFlag()
160 tinfoil.config_data.setVarFlag('TESTVAR', 'flagname', 'flagval')
161 value = tinfoil.config_data.getVarFlag('TESTVAR', 'flagname')
162 self.assertEqual(value, 'flagval', 'Value set using config_data.setVarFlag() is not reflected in config_data.getVarFlag()')
163 # Test delVarFlag()
164 tinfoil.config_data.setVarFlag('TESTVAR', 'otherflag', 'othervalue')
165 tinfoil.config_data.delVarFlag('TESTVAR', 'flagname')
166 value = tinfoil.config_data.getVarFlag('TESTVAR', 'flagname')
167 self.assertEqual(value, None, 'Varflag deleted using config_data.delVarFlag() is not reflected in config_data.getVarFlag()')
168 value = tinfoil.config_data.getVarFlag('TESTVAR', 'otherflag')
169 self.assertEqual(value, 'othervalue', 'Varflag deleted using config_data.delVarFlag() caused unrelated flag to be removed')
170 # Test delVar()
171 tinfoil.config_data.setVar('TESTVAR', 'varvalue')
172 value = tinfoil.config_data.getVar('TESTVAR')
173 self.assertEqual(value, 'varvalue', 'Value set using config_data.setVar() is not reflected in config_data.getVar()')
174 tinfoil.config_data.delVar('TESTVAR')
175 value = tinfoil.config_data.getVar('TESTVAR')
176 self.assertEqual(value, None, 'Variable deleted using config_data.delVar() appears to still have a value')
177 # Test renameVar()
178 tinfoil.config_data.setVar('TESTVAROLD', 'origvalue')
179 tinfoil.config_data.renameVar('TESTVAROLD', 'TESTVARNEW')
180 value = tinfoil.config_data.getVar('TESTVAROLD')
181 self.assertEqual(value, None, 'Variable renamed using config_data.renameVar() still seems to exist')
182 value = tinfoil.config_data.getVar('TESTVARNEW')
183 self.assertEqual(value, 'origvalue', 'Variable renamed using config_data.renameVar() does not appear with new name')
184 # Test overrides
185 tinfoil.config_data.setVar('TESTVAR', 'original')
186 tinfoil.config_data.setVar('TESTVAR_overrideone', 'one')
187 tinfoil.config_data.setVar('TESTVAR_overridetwo', 'two')
188 tinfoil.config_data.appendVar('OVERRIDES', ':overrideone')
189 value = tinfoil.config_data.getVar('TESTVAR')
190 self.assertEqual(value, 'one', 'Variable overrides not functioning correctly')