summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
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')