示例#1
0
 def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
     """
     initiates a benchmark instance, and modifies the trigger run callable by the trigger one
     :param trigger: the trigger instance to be run
     :param args: additional arguments
     :param kwargs: additional keyword arguments
     """
     # noinspection PyCallingNonCallable
     benchmark = trigger.benchmark(trigger)
     benchmark.pre_benchmark_run()
     trigger.run = benchmark.run
示例#2
0
 def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
     """
     initiates a benchmark instance, and modifies the trigger run callable by the trigger one
     :param trigger: the trigger instance to be run
     :param args: additional arguments
     :param kwargs: additional keyword arguments
     """
     # noinspection PyCallingNonCallable
     benchmark = trigger.benchmark(trigger)
     benchmark.pre_benchmark_run()
     trigger.run = benchmark.run
示例#3
0
    def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
        """
        Runs before trigger. Changes the trigger command if a success_cmd is provided, then updates the executable
        :param trigger: The trigger instance that is run
        :param args: other arguments to pass to parents
        :param kwargs: other keyword arguments to pass to parents
        """
        with suppress(AttributeError):
            # noinspection PyUnresolvedReferences
            trigger.cmd = trigger.success_cmd

        trigger_full_path = trigger.cmd.split(" ")[0]
        if os.path.exists("{}-{}".format(trigger_full_path, self.extension)):
            trigger.cmd = trigger.cmd.replace(trigger_full_path, "{}-{}".format(trigger_full_path, self.extension))
            trigger.conf["executable"] = "{}-{}".format(trigger.conf.get("executable"), self.extension)
示例#4
0
    def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
        """
        Runs before trigger. Changes the trigger command if a success_cmd is provided, then updates the executable
        :param trigger: The trigger instance that is run
        :param args: other arguments to pass to parents
        :param kwargs: other keyword arguments to pass to parents
        """
        with suppress(AttributeError):
            # noinspection PyUnresolvedReferences
            trigger.cmd = trigger.success_cmd

        trigger_full_path = trigger.cmd.split(" ")[0]
        if os.path.exists("{}-{}".format(trigger_full_path, self.extension)):
            trigger.cmd = trigger.cmd.replace(
                trigger_full_path, "{}-{}".format(trigger_full_path,
                                                  self.extension))
            trigger.conf["executable"] = "{}-{}".format(
                trigger.conf.get("executable"), self.extension)
示例#5
0
文件: rr.py 项目: AmesianX/bugbase
 def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
     """
     Updates the trigger command to run rr on top of the plugin's command
     :param trigger: the trigger that will run
     :param args: other arguments to pass to parents
     :param kwargs: other keywords arguments to pass to parents
     """
     super().pre_trigger_run(trigger=trigger, **kwargs)
     rr_location = os.path.join(get_global_conf().getdir("utilities", "install_directory"), "rr")
     trigger.cmd = "{} record {}".format(os.path.join(rr_location, "bin/rr"), trigger.cmd)
示例#6
0
文件: rr.py 项目: taolee/bugbase
 def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
     """
     Updates the trigger command to run rr on top of the plugin's command
     :param trigger: the trigger that will run
     :param args: other arguments to pass to parents
     :param kwargs: other keywords arguments to pass to parents
     """
     super().pre_trigger_run(trigger=trigger, **kwargs)
     rr_location = os.path.join(get_global_conf().getdir("utilities", "install_directory"), "rr")
     trigger.cmd = "{} record {}".format(os.path.join(rr_location, "bin/rr"), trigger.cmd)
示例#7
0
文件: fail.py 项目: taolee/bugbase
    def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None:
        """
        Updates the coredumps information in order to generate some correctly
        :param trigger: the trigger instance to use
        :param args: additional arguments
        :param kwargs: additional keyword arguments
        """
        trigger_full_path = trigger.cmd.split(" ")[0]
        if os.path.exists("{}-{}".format(trigger_full_path, self.extension)):
            trigger.cmd = trigger.cmd.replace(trigger_full_path, "{}-{}".format(trigger_full_path, self.extension))
            trigger.conf["executable"] = "{}-{}".format(trigger.conf.get("executable"), self.extension)

        os.makedirs(get_global_conf().getdir("trigger", "core_dump_location"), exist_ok=True)

        core_path = trigger.conf.get_core_path()
        logging.verbose("core_path: %(core_path)s", dict(core_path=core_path))

        with suppress(OSError):
            logging.debug("attempting to delete old coredump at %(core_path)s", dict(core_path=core_path))
            os.remove(core_path)