================ @@ -306,52 +276,79 @@ def main(): run_list = [] line2func_list = collections.defaultdict(list) - subs = { - "%s": ti.path, - "%t": tempfile.NamedTemporaryFile().name, - "%S": os.path.dirname(ti.path), - } + subs = [ + ("%s", ti.path), + ("%t", tempfile.NamedTemporaryFile().name), + ("%S", os.path.dirname(ti.path)), + ] for l in ti.run_lines: - commands = [cmd.strip() for cmd in l.split("|")] - + pipeline = ShParser(l, win32Escapes=False, pipefail=False).parse() + if not isinstance(pipeline, Pipeline): + # Could be a sequence separated by &&/||/; but we don't handle that yet. + print( + "WARNING: RUN: line is too complex for this script: ", + pipeline, + file=sys.stderr, + ) + continue triple_in_cmd = None - m = common.TRIPLE_ARG_RE.search(commands[0]) + clang_cmd: Command = pipeline.commands[0] + m = common.TRIPLE_ARG_RE.search(" ".join(clang_cmd.args)) if m: triple_in_cmd = m.groups()[0] + # Do lit-like substitutions on the command and redirects. + for cmd in pipeline.commands: + if cmd.args[0] == "opt": + if ti.args.opt is None: + sys.exit( + ti.path + " needs to run opt. " + "Please specify --llvm-bin or --opt" + ) + cmd.args[0] = ti.args.opt + cmd.args = [common.applySubstitutions(i, subs) for i in cmd.args] + for i, redirect in enumerate(cmd.redirects): + cmd.redirects[i] = redirect[0], common.applySubstitutions( + redirect[1], subs + ) + # Parse executable args. ---------------- RoboTux wrote:
This comment should be removed. https://github.com/llvm/llvm-project/pull/65333 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits