Ejemplo n.º 1
0
 def discover(self, reference, which_tests=loader.DEFAULT):
     tests = []
     try:
         root = mux.apply_filters(create_from_yaml([reference], False),
                                  getattr(self.args, "mux_suite_only", []),
                                  getattr(self.args, "mux_suite_out", []))
     except Exception:
         return []
     mux_tree = mux.MuxTree(root)
     for variant in mux_tree:
         params = varianter.AvocadoParams(variant, "YamlTestsuiteLoader",
                                          ["/run/*"], {})
         reference = params.get("test_reference")
         test_loader = self._get_loader(params)
         if not test_loader:
             continue
         _tests = test_loader.discover(reference, which_tests)
         self._extra_type_label_mapping.update(
             test_loader.get_full_type_label_mapping())
         self._extra_decorator_mapping.update(
             test_loader.get_full_decorator_mapping())
         if _tests:
             for tst in _tests:
                 tst[1]["params"] = (variant, ["/run/*"])
             tests.extend(_tests)
     return tests
Ejemplo n.º 2
0
 def test_filter_only(self):
     exp = (['intel', 'scsi'], ['intel', 'virtio'])
     act = yaml_to_mux.create_from_yaml(
         ["/:" + PATH_PREFIX + 'examples/mux-selftest.yaml'])
     act = mux.apply_filters(act,
                             ('/hw/cpu/intel', '/distro/fedora', '/hw'))
     act = tuple(mux.MuxTree(act))
     self.assertEqual(act, exp)
Ejemplo n.º 3
0
 def setUp(self):
     yamls = yaml_to_mux.create_from_yaml(
         ["/:" + PATH_PREFIX + 'examples/mux-selftest-params.yaml'])
     self.yamls = iter(mux.MuxTree(yamls))
     self.params1 = varianter.AvocadoParams(self.yamls.next(), 'Unittest1',
                                            ['/ch0/*', '/ch1/*'], {})
     self.yamls.next()  # Skip 2nd
     self.yamls.next()  # and 3rd
     self.params2 = varianter.AvocadoParams(self.yamls.next(), 'Unittest2',
                                            ['/ch1/*', '/ch0/*'], {})
Ejemplo n.º 4
0
 def test_filter_out(self):
     act = yaml_to_mux.create_from_yaml(
         ["/:" + PATH_PREFIX + 'examples/mux-selftest.yaml'])
     act = mux.apply_filters(act, None,
                             ('/hw/cpu/intel', '/distro/fedora', '/distro'))
     act = tuple(mux.MuxTree(act))
     self.assertEqual(len(act), 4)
     self.assertEqual(len(act[0]), 3)
     str_act = str(act)
     self.assertIn('amd', str_act)
     self.assertIn('prod', str_act)
     self.assertNotIn('intel', str_act)
     self.assertNotIn('fedora', str_act)
Ejemplo n.º 5
0
 def test_create_variants(self):
     from_file = yaml_to_mux.create_from_yaml(
         ["/:" + PATH_PREFIX + 'examples/mux-selftest.yaml'])
     from_file = mux.MuxTree(from_file)
     self.assertEqual(self.mux_full, tuple(from_file))
Ejemplo n.º 6
0
 def test_partial(self):
     exp = (['intel', 'scsi'], ['intel', 'virtio'], ['amd', 'scsi'],
            ['amd', 'virtio'], ['arm', 'scsi'], ['arm', 'virtio'])
     act = tuple(mux.MuxTree(self.mux_tree.children[0]))
     self.assertEqual(act, exp)
Ejemplo n.º 7
0
 def test_empty(self):
     act = tuple(mux.MuxTree(mux.MuxTreeNode()))
     self.assertEqual(act, ([
         '',
     ], ))
Ejemplo n.º 8
0
 def setUp(self):
     self.mux_tree = yaml_to_mux.create_from_yaml(
         ['/:' + PATH_PREFIX + 'examples/mux-selftest.'
          'yaml'])
     self.mux_full = tuple(mux.MuxTree(self.mux_tree))