diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-28 17:13:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:50:46 +0100 |
commit | a730981b75ebb528e447eb3e41c83440dbc133bd (patch) | |
tree | 6aa6f52e3724d786fe946a2452f372efab69b1d6 /bitbake/lib/bb/tests/data.py | |
parent | 4c386e1dd5df8e1bfb675f1a7f47c1162ec76d07 (diff) | |
download | poky-a730981b75ebb528e447eb3e41c83440dbc133bd.tar.gz |
bitbake: tests/data: Add new data tests
Add a variety of tests which were found to be useful when working
on the data store recently.
(Bitbake rev: 5c5f8da509f6bbc1fad263462142519ef3d54a35)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/data.py')
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 2c2e7ae48b..e9aab577f6 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -270,6 +270,13 @@ class TestConcatOverride(unittest.TestCase): | |||
270 | bb.data.update_data(self.d) | 270 | bb.data.update_data(self.d) |
271 | self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar") | 271 | self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar") |
272 | 272 | ||
273 | def test_append_unset(self): | ||
274 | self.d.setVar("TEST_prepend", "${FOO}:") | ||
275 | self.d.setVar("TEST_append", ":val2") | ||
276 | self.d.setVar("TEST_append", ":${BAR}") | ||
277 | bb.data.update_data(self.d) | ||
278 | self.assertEqual(self.d.getVar("TEST", True), "foo::val2:bar") | ||
279 | |||
273 | def test_remove(self): | 280 | def test_remove(self): |
274 | self.d.setVar("TEST", "${VAL} ${BAR}") | 281 | self.d.setVar("TEST", "${VAL} ${BAR}") |
275 | self.d.setVar("TEST_remove", "val") | 282 | self.d.setVar("TEST_remove", "val") |
@@ -318,12 +325,52 @@ class TestOverrides(unittest.TestCase): | |||
318 | bb.data.update_data(self.d) | 325 | bb.data.update_data(self.d) |
319 | self.assertEqual(self.d.getVar("TEST", True), "testvalue2") | 326 | self.assertEqual(self.d.getVar("TEST", True), "testvalue2") |
320 | 327 | ||
328 | def test_one_override_unset(self): | ||
329 | self.d.setVar("TEST2_bar", "testvalue2") | ||
330 | bb.data.update_data(self.d) | ||
331 | self.assertEqual(self.d.getVar("TEST2", True), "testvalue2") | ||
332 | self.assertItemsEqual(self.d.keys(), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar']) | ||
333 | |||
321 | def test_multiple_override(self): | 334 | def test_multiple_override(self): |
322 | self.d.setVar("TEST_bar", "testvalue2") | 335 | self.d.setVar("TEST_bar", "testvalue2") |
323 | self.d.setVar("TEST_local", "testvalue3") | 336 | self.d.setVar("TEST_local", "testvalue3") |
324 | self.d.setVar("TEST_foo", "testvalue4") | 337 | self.d.setVar("TEST_foo", "testvalue4") |
325 | bb.data.update_data(self.d) | 338 | bb.data.update_data(self.d) |
326 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 339 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") |
340 | self.assertItemsEqual(self.d.keys(), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local']) | ||
341 | |||
342 | def test_multiple_combined_overrides(self): | ||
343 | self.d.setVar("TEST_local_foo_bar", "testvalue3") | ||
344 | bb.data.update_data(self.d) | ||
345 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | ||
346 | |||
347 | def test_multiple_overrides_unset(self): | ||
348 | self.d.setVar("TEST2_local_foo_bar", "testvalue3") | ||
349 | bb.data.update_data(self.d) | ||
350 | self.assertEqual(self.d.getVar("TEST2", True), "testvalue3") | ||
351 | |||
352 | def test_keyexpansion_override(self): | ||
353 | self.d.setVar("LOCAL", "local") | ||
354 | self.d.setVar("TEST_bar", "testvalue2") | ||
355 | self.d.setVar("TEST_${LOCAL}", "testvalue3") | ||
356 | self.d.setVar("TEST_foo", "testvalue4") | ||
357 | bb.data.update_data(self.d) | ||
358 | bb.data.expandKeys(self.d) | ||
359 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | ||
360 | |||
361 | def test_rename_override(self): | ||
362 | self.d.setVar("ALTERNATIVE_ncurses-tools_class-target", "a") | ||
363 | self.d.setVar("OVERRIDES", "class-target") | ||
364 | bb.data.update_data(self.d) | ||
365 | self.d.renameVar("ALTERNATIVE_ncurses-tools", "ALTERNATIVE_lib32-ncurses-tools") | ||
366 | self.assertEqual(self.d.getVar("ALTERNATIVE_lib32-ncurses-tools", True), "a") | ||
367 | |||
368 | def test_underscore_override(self): | ||
369 | self.d.setVar("TEST_bar", "testvalue2") | ||
370 | self.d.setVar("TEST_some_val", "testvalue3") | ||
371 | self.d.setVar("TEST_foo", "testvalue4") | ||
372 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | ||
373 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | ||
327 | 374 | ||
328 | class TestKeyExpansion(unittest.TestCase): | 375 | class TestKeyExpansion(unittest.TestCase): |
329 | def setUp(self): | 376 | def setUp(self): |