示例#1
0
    def _test_exit_code(self,
                        contents,
                        expected,
                        sim_ok=True,
                        has_valid_exit_code=False,
                        waschecked=False):
        """
        Helper method to test the check_results function
        """
        with create_tempdir() as path:
            file_name = join(path, "vunit_results")
            if contents is not None:
                with open(file_name, "w") as fptr:
                    fptr.write(contents)

            sim_if = SimulatorInterface

            @staticmethod
            def func():
                return has_valid_exit_code

            sim_if.has_valid_exit_code = func

            run = TestRun(simulator_if=sim_if,
                          config=None,
                          elaborate_only=False,
                          test_suite_name=None,
                          test_cases=expected)

            results = run._read_test_results(file_name=file_name)  # pylint: disable=protected-access
            self.assertEqual(
                run._check_results(results, sim_ok),  # pylint: disable=protected-access
                (waschecked, expected))
示例#2
0
def _create_config(**kwargs):
    """
    Helper function to create a config
    """
    with create_tempdir() as tempdir:
        design_unit = Entity('tb_entity', file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]
        yield Configuration('name', design_unit, **kwargs)
示例#3
0
def _create_config(**kwargs):
    """
    Helper function to create a config
    """
    with create_tempdir() as tempdir:
        design_unit = Entity('tb_entity',
                             file_name=join(tempdir, "file.vhd"))
        design_unit.generic_names = ["runner_cfg"]
        yield Configuration('name', design_unit, **kwargs)
示例#4
0
    def _read_test_results(contents, expected_test_cases):
        """
        Helper method to test the read_test_results function
        """
        with create_tempdir() as path:
            file_name = join(path, "vunit_results")
            if contents is not None:
                with open(file_name, "w") as fptr:
                    fptr.write(contents)

            run = TestRun(simulator_if=None,
                          config=None,
                          elaborate_only=False,
                          test_suite_name=None,
                          test_cases=expected_test_cases)
            return run._read_test_results(file_name=file_name)  # pylint: disable=protected-access
示例#5
0
    def _read_test_results(contents, expected_test_cases):
        """
        Helper method to test the read_test_results function
        """
        with create_tempdir() as path:
            file_name = join(path, "vunit_results")
            if contents is not None:
                with open(file_name, "w") as fptr:
                    fptr.write(contents)

            run = TestRun(simulator_if=None,
                          config=None,
                          elaborate_only=False,
                          test_suite_name=None,
                          test_cases=expected_test_cases)
            return run._read_test_results(file_name=file_name)  # pylint: disable=protected-access