def cmdline(self, executable, options, task, rlimits):
        """
        Prepare command for the coveriteam program for a verifier or a validator.
        These two programs are shipped with the CoVeriTeam package,
        and can be used with multiple verifiers and validators.
        """

        data_model_param = get_data_model_from_task(task, {
            ILP32: "ILP32",
            LP64: "LP64"
        })
        if data_model_param and not any(
                re.match("data_model *=", option) for option in options):
            options += ["--input", "data_model=" + data_model_param]

        if task.property_file:
            options += ["--input", "specification_path=" + task.property_file]
        else:
            raise UnsupportedFeatureException(
                "Can't execute CoVeriTeam-Verifier-Validator: "
                "Specification is missing.")

        options += ["--input", "program_path=" + task.single_input_file]

        return [executable] + options
    def cmdline(self, executable, options, task, rlimits):
        """
        Compose the command line to execute from the name of the executable,
        the user-specified options, and the inputfile to analyze.

        All paths passed to this method (executable, tasks, and propertyfile)
        are either absolute or have been made relative to the designated working directory.

        @param executable: the path to the executable of the tool (typically the result of executable())
        @param options: a list of options, in the same order as given in the XML-file.
        @param tasks: a list of tasks, that should be analysed with the tool in one run.
                            A typical run has only one input file, but there can be more than one.
        @param propertyfile: contains a specification for the verifier (optional, not always present).
        @param rlimits: This dictionary contains resource-limits for a run,
                        for example: time-limit, soft-time-limit, hard-time-limit, memory-limit, cpu-core-limit.
                        All entries in rlimits are optional, so check for existence before usage!
        @return a list of strings that represent the command line to execute
        """
        if task.property_file:
            options = options + ["--propertyfile", task.property_file]

        data_model_param = get_data_model_from_task(task, {
            ILP32: "-m32",
            LP64: "-m64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + list(task.input_files_or_identifier)
Exemple #3
0
    def cmdline(self, executable, options, task, rlimits):
        """
        Compose the command line to execute from the name of the executable,
        the user-specified options, and the inputfile to analyze.
        This method can get overridden, if, for example, some options should
        be enabled or if the order of arguments must be changed.

        All paths passed to this method (executable, tasks, and propertyfile)
        are either absolute or have been made relative to the designated working directory.

        @param executable: the path to the executable of the tool (typically the result of executable())
        @param options: a list of options, in the same order as given in the XML-file.
        @param tasks: a list of tasks, that should be analysed with the tool in one run.
                            In most cases we we have only _one_ inputfile.
        @param propertyfile: contains a specification for the verifier.
        @param rlimits: This dictionary contains resource-limits for a run,
                        for example: time-limit, soft-time-limit, hard-time-limit, memory-limit, cpu-core-limit.
                        All entries in rlimits are optional, so check for existence before usage!
        """
        data_model_param = get_data_model_from_task(task, {
            ILP32: "--32",
            LP64: "--64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        directory = os.path.dirname(executable)
        prp = task.property_file or "-"

        # prefix command line with wrapper script
        return ([os.path.join(directory, self.BINS[1]), executable, prp] +
                options + list(task.input_files_or_identifier))
Exemple #4
0
    def _get_additional_options(self, existing_options, task, rlimits):
        options = []
        if rlimits.cputime and "-timelimit" not in existing_options:
            options += ["-timelimit", str(rlimits.cputime)]

        if task.property_file:
            options += ["-p", task.property_file]

        # try:
        #     options += ["-f", task.single_input_file]
        # except benchexec.tools.template.UnsupportedFeatureException:
        #     raise benchexec.tools.template.UnsupportedFeatureException(
        #         "Unsupported task with multiple input files for task '{}'".format(task)
        # )

        if isinstance(task.options, dict) and task.options.get("language") == "C":
            data_model = task.options.get("data_model")
            if data_model:
                data_model_option = get_data_model_from_task(
                    task, {ILP32: "-m 32", LP64: "-m 64"}
                )
                if data_model_option:
                    if data_model_option not in existing_options:
                        options += [data_model_option]
                else:
                    raise benchexec.tools.template.UnsupportedFeatureException(
                        "Unsupported data_model '{}' defined for task '{}'".format(
                            data_model, task
                        )
                    )
        return options
Exemple #5
0
    def cmdline(self, executable, options, task, rlimits):
        data_model_param = get_data_model_from_task(task, {ILP32: "--32", LP64: "--64"})
        if not data_model_param:
            data_model_param = "--32"
        if data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + [task.single_input_file]
Exemple #6
0
    def cmdline(self, executable, options, task, rlimits):
        data_model_param = get_data_model_from_task(task, {
            ILP32: None,
            LP64: "--64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable, *options, *task.input_files_or_identifier]
Exemple #7
0
 def cmdline(self, executable, options, task, rlimits):
     data_model_param = get_data_model_from_task(task, {
         ILP32: "32",
         LP64: "64"
     })
     if data_model_param and "--arch" not in options:
         options += ["--arch", data_model_param]
     return ([executable] + ["-p", task.property_file] + options +
             [task.single_input_file])
Exemple #8
0
    def cmdline(self, executable, options, task, rlimits):
        data_model_param = get_data_model_from_task(task, {
            ILP32: "32",
            LP64: "64"
        })
        if data_model_param and self.BIT_WIDTH_PARAMETER_NAME not in options:
            options += [self.BIT_WIDTH_PARAMETER_NAME, data_model_param]

        return [executable, *options, task.single_input_file]
Exemple #9
0
 def cmdline(self, executable, options, task, rlimits):
     if task.property_file:
         options += ["--svcomp-spec", task.property_file]
     data_model_param = get_data_model_from_task(
         task, {ILP32: "32bit", LP64: "64bit"}
     )
     if data_model_param:
         options += ["--svcomp-arch", data_model_param]
     return [executable] + options + list(task.input_files)
Exemple #10
0
    def cmdline(self, executable, options, task, rlimits):
        data_model_param = get_data_model_from_task(task, {
            ILP32: "32",
            LP64: "64"
        })
        if data_model_param and "--architecture" not in options:
            options += ["--architecture", data_model_param]

        return [executable] + options + list(task.input_files_or_identifier)
Exemple #11
0
    def cmdline(self, executable, options, task, rlimits):
        data_model_param = get_data_model_from_task(task, {ILP32: "-32", LP64: "-64"})
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        cmd = [executable] + options
        if task.property_file:
            cmd += ["--goal", task.property_file]

        return cmd + list(task.input_files_or_identifier)
Exemple #12
0
    def cmdline(self, executable, options, task, rlimits):
        if task.property_file:
            options = options + ["--propertyfile", task.property_file]
        data_model_param = get_data_model_from_task(task, {
            ILP32: "--32",
            LP64: "--64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + list(task.input_files_or_identifier)
Exemple #13
0
    def cmdline(self, executable, options, task, rlimits):
        spec = ["--propertyfile", task.property_file] if task.property_file else []

        data_model_param = get_data_model_from_task(
            task,
            {ILP32: "--compiler-options=-m32", LP64: "--compiler-options=-m64"},
        )
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + spec + list(task.input_files_or_identifier)
Exemple #14
0
 def cmdline(self, executable, options, task, rlimits):
     data_model_param = get_data_model_from_task(task, {
         ILP32: "32",
         LP64: "64"
     })
     if data_model_param and "--arch" not in options:
         options += ["-a", data_model_param]
     if not task.property_file:
         raise benchexec.tools.template.UnsupportedFeatureException(
             "Property file required")
     return ([executable] + ["-p", task.property_file] + options +
             [task.single_input_file])
Exemple #15
0
 def cmdline(self, executable, options, task, rlimits):
     data_model_param = get_data_model_from_task(task, {
         ILP32: ["-bw", "32"],
         LP64: ["-bw", "64"]
     })
     if data_model_param:
         options += data_model_param
     options += ["-t", "--sh-mem-leak", "--add-line-info"]
     if task.property_file:
         options += ["--svcomp-property", task.property_file]
     options += [task.single_input_file]
     return [executable] + options
Exemple #16
0
    def cmdline(self, executable, options, task, rlimits):
        """
        Compose the command line to execute from the name of the executable
        """

        if task.property_file:
            options = options + ["--prp={0}".format(task.property_file)]

        data_model_param = get_data_model_from_task(task, {
            ILP32: "--32",
            LP64: "--64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + list(task.input_files_or_identifier)
Exemple #17
0
    def cmdline(self, executable, options, task, rlimits):
        if task.property_file:
            options += [f"--property-file={task.property_file}"]
        if rlimits.memory:
            options += [f"--max-memory={rlimits.memory}"]
        if rlimits.cputime:
            options += [f"--max-cputime-soft={rlimits.cputime}"]

        data_model_param = get_data_model_from_task(task, {
            ILP32: "--32",
            LP64: "--64"
        })
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + list(task.input_files_or_identifier)
    def _get_additional_data_model_from_task(self, options, task) -> List[str]:
        data_model_param = get_data_model_from_task(task, {
            ILP32: "32bit",
            LP64: "64bit"
        })

        if data_model_param:
            arch = ["--architecture", data_model_param]
            if "--architecture" not in options:
                return arch
            elif data_model_param in options:
                # architecture and data_model_param in options, I guess these are the options we want
                pass
            else:
                # arch is no sublist, but architecture is already specified
                logging.warning(
                    "You specified %s as options, but the task has a different value: %s",
                    options,
                    arch,
                )
        return []
Exemple #19
0
    def cmdline(self, executable, options, task, rlimits):
        """
        Allows us to define special actions to be taken or command line argument
        modifications to make just before calling SMACK.
        """
        data_model_param = get_data_model_from_task(task, {
            ILP32: "-m32",
            LP64: "-m64"
        })
        print(options)
        if data_model_param and not any(
                option.startswith("--clang-options=") for option in options):
            options += ["--clang-options=" + data_model_param]

        if task.property_file:
            options += ["--svcomp-property", task.property_file]
        else:
            raise UnsupportedFeatureException(
                "SMACK can't execute without a property file.")

        options += [task.single_input_file]

        return [executable] + options
Exemple #20
0
    def cmdline(self, executable, options, task, rlimits):
        """
        Compose the command line to execute from the name of the executable,
        the user-specified options, and the inputfile to analyze.
        This method can get overridden, if, for example, some options should
        be enabled or if the order of arguments must be changed.
        All paths passed to this method (executable, tasks)
        are either absolute or have been made relative to the designated working directory.
        @param executable: the path to the executable of the tool (typically the result of executable())
        @param options: a list of options, in the same order as given in the XML-file.
        @param tasks: a list of tasks, that should be analysed with the tool in one run.
                      In most cases we we have only _one_ inputfile.
        @param rlimits: This dictionary contains resource-limits for a run,
                        for example: time-limit, soft-time-limit, hard-time-limit, memory-limit, cpu-core-limit.
                        All entries in rlimits are optional, so check for existence before usage!
        """
        if task.property_file:
            options = options + [f"--property={task.property_file}"]

        data_model_param = get_data_model_from_task(task, {ILP32: "--32", LP64: "--64"})
        if data_model_param and data_model_param not in options:
            options += [data_model_param]

        return [executable] + options + [task.single_input_file]