Exemplo n.º 1
0
 def __init__(self):
     """
     Fetches the configuration of the program and stores it in conf.
     """
     self.__cmd__ = None
     self.__returned_information__ = None
     self.conf = get_trigger_conf(self.program)
Exemplo n.º 2
0
 def __init__(self):
     """
     Fetches the configuration of the program and stores it in conf.
     """
     self.__cmd__ = None
     self.__returned_information__ = None
     self.conf = get_trigger_conf(self.program)
Exemplo n.º 3
0
def parse_args(args: list) -> dict:
    """
    Create a parser for command line attributes and parses them
    :param args: the arguments to parse
    :return: parsed arguments
    """
    parser = SmartArgumentParser(
        description="Triggers some bug in listed programs", parents=[arguments.get_verbosity_parser()]
    )
    plugin_parser = parser.add_subparsers(metavar="plugin")
    parser.add_argument(
        "bugs",
        nargs="+",
        type=str,
        help="one of {} or all".format(", ".join(PROGRAMS)),
        metavar="bug",
        choices=PROGRAMS + ["all"],
    )

    register_for_trigger(parser=parser, subparser=plugin_parser)

    parsed_args = parser.parse_args(args)

    # noinspection PyUnresolvedReferences
    logging.getLogger().setLevel(parsed_args.logging_level)

    _bugs = parsed_args.bugs
    if "all" in _bugs:
        parsed_args.bugs = [
            program for program in PROGRAMS if os.path.exists(get_trigger_conf(program).get("install_directory"))
        ]
    else:
        for _ in _bugs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(PROGRAM_ARGUMENT_ERROR)

    return vars(parsed_args)
Exemplo n.º 4
0
    def compile(self, _compiler_: Compiler, _program_: Program) -> None:
        """
        Compiles and installs the given program with the given compiler

        :param _compiler_: the compiler to use
        :param _program_: the program to compile
        """
        _compiler_.is_configured.wait()
        try:
            with TestRunner.EnvManager(_compiler_, _program_.name):
                error = main([_program_.name], True, 1)
                self.assertFalse(
                    error, "The program {} failed to compile with {}".format(
                        _program_.name,
                        get_global_conf().get("install", "compiler")))

                # Checks that bitcode was indeed created at the correct place
                if _compiler_.bitcode:
                    conf = get_trigger_conf(_program_.name)
                    self.assertTrue(
                        os.path.exists(conf.get_executable() + ".bc"))
        finally:
            _program_.is_installed.set()
Exemplo n.º 5
0
def parse_args(args: list) -> dict:
    """
    Create a parser for command line attributes and parses them
    :param args: the arguments to parse
    :return: parsed arguments
    """
    parser = SmartArgumentParser(
        description="Triggers some bug in listed programs",
        parents=[arguments.get_verbosity_parser()])
    plugin_parser = parser.add_subparsers(metavar="plugin")
    parser.add_argument("bugs",
                        nargs="+",
                        type=str,
                        help="one of {} or all".format(", ".join(PROGRAMS)),
                        metavar="bug",
                        choices=PROGRAMS + ["all"])

    register_for_trigger(parser=parser, subparser=plugin_parser)

    parsed_args = parser.parse_args(args)

    # noinspection PyUnresolvedReferences
    logging.getLogger().setLevel(parsed_args.logging_level)

    _bugs = parsed_args.bugs
    if "all" in _bugs:
        parsed_args.bugs = [
            program for program in PROGRAMS if os.path.exists(
                get_trigger_conf(program).get("install_directory"))
        ]
    else:
        for _ in _bugs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(PROGRAM_ARGUMENT_ERROR)

    return vars(parsed_args)
Exemplo n.º 6
0
    def compile(self, _compiler_: Compiler, _program_: Program) -> None:
        """
        Compiles and installs the given program with the given compiler

        :param _compiler_: the compiler to use
        :param _program_: the program to compile
        """
        _compiler_.is_configured.wait()
        try:
            with TestRunner.EnvManager(_compiler_, _program_.name):
                error = main([_program_.name], True, 1)
                self.assertFalse(
                    error,
                    "The program {} failed to compile with {}".format(
                        _program_.name, get_global_conf().get("install", "compiler")
                    ),
                )

                # Checks that bitcode was indeed created at the correct place
                if _compiler_.bitcode:
                    conf = get_trigger_conf(_program_.name)
                    self.assertTrue(os.path.exists(conf.get_executable() + ".bc"))
        finally:
            _program_.is_installed.set()