diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 3e49984c93..2b137706dd 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -544,142 +544,3 @@ class Serialize(unittest.TestCase): | |||
544 | self.assertEqual(newd.getVarFlag('HELLO', 'other'), 'planet') | 544 | self.assertEqual(newd.getVarFlag('HELLO', 'other'), 'planet') |
545 | 545 | ||
546 | 546 | ||
547 | # Remote datastore tests | ||
548 | # These really only test the interface, since in actual usage we have a | ||
549 | # tinfoil connector that does everything over RPC, and this doesn't test | ||
550 | # that. | ||
551 | |||
552 | class TestConnector: | ||
553 | d = None | ||
554 | def __init__(self, d): | ||
555 | self.d = d | ||
556 | def getVar(self, name): | ||
557 | return self.d._findVar(name) | ||
558 | def getKeys(self): | ||
559 | return set(self.d.keys()) | ||
560 | def getVarHistory(self, name): | ||
561 | return self.d.varhistory.variable(name) | ||
562 | def expandPythonRef(self, varname, expr, d): | ||
563 | localdata = self.d.createCopy() | ||
564 | for key in d.localkeys(): | ||
565 | localdata.setVar(d.getVar(key)) | ||
566 | varparse = bb.data_smart.VariableParse(varname, localdata) | ||
567 | return varparse.python_sub(expr) | ||
568 | def setVar(self, name, value): | ||
569 | self.d.setVar(name, value) | ||
570 | def setVarFlag(self, name, flag, value): | ||
571 | self.d.setVarFlag(name, flag, value) | ||
572 | def delVar(self, name): | ||
573 | self.d.delVar(name) | ||
574 | return False | ||
575 | def delVarFlag(self, name, flag): | ||
576 | self.d.delVarFlag(name, flag) | ||
577 | return False | ||
578 | def renameVar(self, name, newname): | ||
579 | self.d.renameVar(name, newname) | ||
580 | return False | ||
581 | |||
582 | class Remote(unittest.TestCase): | ||
583 | def test_remote(self): | ||
584 | |||
585 | d1 = bb.data.init() | ||
586 | d1.enableTracking() | ||
587 | d2 = bb.data.init() | ||
588 | d2.enableTracking() | ||
589 | connector = TestConnector(d1) | ||
590 | |||
591 | d2.setVar('_remote_data', connector) | ||
592 | |||
593 | d1.setVar('HELLO', 'world') | ||
594 | d1.setVarFlag('OTHER', 'flagname', 'flagvalue') | ||
595 | self.assertEqual(d2.getVar('HELLO'), 'world') | ||
596 | self.assertEqual(d2.expand('${HELLO}'), 'world') | ||
597 | self.assertEqual(d2.expand('${@d.getVar("HELLO")}'), 'world') | ||
598 | self.assertIn('flagname', d2.getVarFlags('OTHER')) | ||
599 | self.assertEqual(d2.getVarFlag('OTHER', 'flagname'), 'flagvalue') | ||
600 | self.assertEqual(d1.varhistory.variable('HELLO'), d2.varhistory.variable('HELLO')) | ||
601 | # Test setVar on client side affects server | ||
602 | d2.setVar('HELLO', 'other-world') | ||
603 | self.assertEqual(d1.getVar('HELLO'), 'other-world') | ||
604 | # Test setVarFlag on client side affects server | ||
605 | d2.setVarFlag('HELLO', 'flagname', 'flagvalue') | ||
606 | self.assertEqual(d1.getVarFlag('HELLO', 'flagname'), 'flagvalue') | ||
607 | # Test client side data is incorporated in python expansion (which is done on server) | ||
608 | d2.setVar('FOO', 'bar') | ||
609 | self.assertEqual(d2.expand('${@d.getVar("FOO")}'), 'bar') | ||
610 | # Test overrides work | ||
611 | d1.setVar('FOO_test', 'baz') | ||
612 | d1.appendVar('OVERRIDES', ':test') | ||
613 | self.assertEqual(d2.getVar('FOO'), 'baz') | ||
614 | |||
615 | |||
616 | # Remote equivalents of local test classes | ||
617 | # Note that these aren't perfect since we only test in one direction | ||
618 | |||
619 | class RemoteDataExpansions(DataExpansions): | ||
620 | def setUp(self): | ||
621 | self.d1 = bb.data.init() | ||
622 | self.d = bb.data.init() | ||
623 | self.d1["foo"] = "value_of_foo" | ||
624 | self.d1["bar"] = "value_of_bar" | ||
625 | self.d1["value_of_foo"] = "value_of_'value_of_foo'" | ||
626 | connector = TestConnector(self.d1) | ||
627 | self.d.setVar('_remote_data', connector) | ||
628 | |||
629 | class TestRemoteNestedExpansions(TestNestedExpansions): | ||
630 | def setUp(self): | ||
631 | self.d1 = bb.data.init() | ||
632 | self.d = bb.data.init() | ||
633 | self.d1["foo"] = "foo" | ||
634 | self.d1["bar"] = "bar" | ||
635 | self.d1["value_of_foobar"] = "187" | ||
636 | connector = TestConnector(self.d1) | ||
637 | self.d.setVar('_remote_data', connector) | ||
638 | |||
639 | class TestRemoteConcat(TestConcat): | ||
640 | def setUp(self): | ||
641 | self.d1 = bb.data.init() | ||
642 | self.d = bb.data.init() | ||
643 | self.d1.setVar("FOO", "foo") | ||
644 | self.d1.setVar("VAL", "val") | ||
645 | self.d1.setVar("BAR", "bar") | ||
646 | connector = TestConnector(self.d1) | ||
647 | self.d.setVar('_remote_data', connector) | ||
648 | |||
649 | class TestRemoteConcatOverride(TestConcatOverride): | ||
650 | def setUp(self): | ||
651 | self.d1 = bb.data.init() | ||
652 | self.d = bb.data.init() | ||
653 | self.d1.setVar("FOO", "foo") | ||
654 | self.d1.setVar("VAL", "val") | ||
655 | self.d1.setVar("BAR", "bar") | ||
656 | connector = TestConnector(self.d1) | ||
657 | self.d.setVar('_remote_data', connector) | ||
658 | |||
659 | class TestRemoteOverrides(TestOverrides): | ||
660 | def setUp(self): | ||
661 | self.d1 = bb.data.init() | ||
662 | self.d = bb.data.init() | ||
663 | self.d1.setVar("OVERRIDES", "foo:bar:local") | ||
664 | self.d1.setVar("TEST", "testvalue") | ||
665 | connector = TestConnector(self.d1) | ||
666 | self.d.setVar('_remote_data', connector) | ||
667 | |||
668 | class TestRemoteKeyExpansion(TestKeyExpansion): | ||
669 | def setUp(self): | ||
670 | self.d1 = bb.data.init() | ||
671 | self.d = bb.data.init() | ||
672 | self.d1.setVar("FOO", "foo") | ||
673 | self.d1.setVar("BAR", "foo") | ||
674 | connector = TestConnector(self.d1) | ||
675 | self.d.setVar('_remote_data', connector) | ||
676 | |||
677 | class TestRemoteFlags(TestFlags): | ||
678 | def setUp(self): | ||
679 | self.d1 = bb.data.init() | ||
680 | self.d = bb.data.init() | ||
681 | self.d1.setVar("foo", "value of foo") | ||
682 | self.d1.setVarFlag("foo", "flag1", "value of flag1") | ||
683 | self.d1.setVarFlag("foo", "flag2", "value of flag2") | ||
684 | connector = TestConnector(self.d1) | ||
685 | self.d.setVar('_remote_data', connector) | ||