Beispiel #1
0
    def test_elaborate_e_project(self):
        design_unit = Entity("tb_entity", file_name=str(Path("tempdir") / "file.vhd"))
        design_unit.original_file_name = str(Path("tempdir") / "other_path" / "original_file.vhd")
        design_unit.generic_names = ["runner_cfg", "tb_path"]

        config = Configuration("name", design_unit, sim_options={"ghdl.elab_e": True})

        simif = GHDLInterface(prefix="prefix", output_path="")
        simif._vhdl_standard = VHDL.standard("2008")  # pylint: disable=protected-access
        simif._project = Project()  # pylint: disable=protected-access
        simif._project.add_library("lib", "lib_path")  # pylint: disable=protected-access

        self.assertEqual(
            simif._get_command(  # pylint: disable=protected-access
                config, str(Path("output_path") / "ghdl"), True, True, None
            ),
            [
                str(Path("prefix") / "ghdl"),
                "-e",
                "--std=08",
                "--work=lib",
                "--workdir=lib_path",
                "-Plib_path",
                "-o",
                str(Path("output_path") / "ghdl" / "tb_entity-arch"),
                "tb_entity",
                "arch",
            ],
        )
Beispiel #2
0
 def test_adds_tb_path_generic(self, tempdir):
     design_unit_tb_path = Entity("tb_entity_without_tb_path", file_name=str(Path(tempdir) / "file.vhd"))
     tb_path = str(Path(tempdir) / "other_path")
     design_unit_tb_path.original_file_name = str(Path(tb_path) / "original_file.vhd")
     design_unit_tb_path.generic_names = ["runner_cfg", "tb_path"]
     config_tb_path = Configuration("name", design_unit_tb_path)
     self.assertEqual(config_tb_path.generics["tb_path"], (tb_path + "/").replace("\\", "/"))
Beispiel #3
0
def _create_config(**kwargs):
    """
    Helper function to create a config
    """
    with create_tempdir() as tempdir:
        design_unit = Entity("tb_entity", file_name=str(Path(tempdir) / "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]
        yield Configuration("name", design_unit, **kwargs)
    def test_tb_filter_requires_runner_cfg(self, tempdir):
        design_unit = Entity("tb_entity", file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]
        self.assertTrue(tb_filter(design_unit))

        design_unit = Entity("tb_entity", file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = []
        self.assertFalse(tb_filter(design_unit))

        design_unit = Module("tb_module", file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]
        self.assertTrue(tb_filter(design_unit))

        design_unit = Module("tb_module", file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = []
        self.assertFalse(tb_filter(design_unit))
Beispiel #5
0
 def test_tb_filter_match_prefix_and_suffix_only(self, tempdir):
     """
     Issue #263
     """
     with mock.patch("vunit.test.bench_list.LOGGER", autospec=True) as logger:
         design_unit = Entity("mul_tbl_scale", file_name=str(Path(tempdir) / "file.vhd"))
         self.assertFalse(tb_filter(design_unit))
         self.assertFalse(logger.warning.called)
Beispiel #6
0
    def test_tb_filter_warning_on_runner_cfg_but_not_matching_tb_pattern(self, tempdir):
        design_unit = Entity("entity_ok_but_warning", file_name=str(Path(tempdir) / "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]

        with mock.patch("vunit.test.bench_list.LOGGER", autospec=True) as logger:
            self.assertTrue(tb_filter(design_unit))
            logger.warning.assert_has_calls(
                [
                    mock.call(
                        "%s %s has runner_cfg %s but the file name and the %s name does not match regex %s\n"
                        "in file %s",
                        "Entity",
                        "entity_ok_but_warning",
                        "generic",
                        "entity",
                        "^(tb_.*)|(.*_tb)$",
                        design_unit.file_name,
                    )
                ]
            )