示例#1
0
def build_makefile_exp(settings):
    """Make sure that the replacements are idempotent."""
    # We use "tip" here to have a new folder be created each time
    combos = [(Translator(), Preprocessor(), Planner(rev='tip', dest=name))
              for name, replacements in settings]
    checkouts.checkout(combos)
    # Make adjustments to Makefiles
    for (name, replacements), combo in zip(settings, combos):
        translator, preprocessor, planner = combo
        makefile_path = os.path.join(planner.bin_dir, 'Makefile')
        change_makefile(makefile_path, opt, replacements)

    downward_experiments.build_experiment(combos)
    def __init__(self, combinations, parser=None):
        self.combinations = combinations
        parser = parser or experiments.ExpArgParser()
        parser.add_argument("--preprocess", action="store_true", help="build preprocessing experiment")
        parser.add_argument("--complete", action="store_true", help="build complete experiment (overrides -p)")
        compact_help = (
            "link to preprocessing files instead of copying them. "
            "Only use this option if the preprocessed files will "
            "NOT be changed during the experiment. This option "
            "only has an effect if neither --preprocess nor "
            "--complete are set."
        )
        parser.add_argument("--compact", action="store_true", help=compact_help)
        parser.add_argument("-s", "--suite", default=[], type=tools.csv, required=True, help=downward_suites.HELP)
        parser.add_argument(
            "-c",
            "--configs",
            default=[],
            type=tools.csv,
            required=False,
            dest="config_nicks",
            help=downward_configs.HELP,
        )

        experiments.Experiment.__init__(self, parser)

        config_needed = self.complete or not self.preprocess
        if config_needed and not self.config_nicks:
            logging.error("Please specify at least one planner configuration")
            sys.exit(2)

        # Save if this is a compact experiment i.e. preprocess files are copied
        compact = self.compact and not self.preprocess and not self.complete
        self.set_property("compact", compact)

        checkouts.checkout(combinations)
        checkouts.compile(combinations)
        # require_src_dirs(self, combinations)
        self.problems = downward_suites.build_suite(self.suite)
        self.configs = _get_configs(self.config_nicks)

        self.make_runs()