diff --git a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c --- a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c @@ -1,6 +1,6 @@ // Check that the non-clang/non-filechecked runlines execute -// RUN: cp %s %S/Output/execute-all-runlines.copy.c -// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c +// RUN: cp %s %S/execute-all-runlines.copy.c +// RUN: cp %S/execute-all-runlines.copy.c %s.copy.c // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-pch %s -o %t diff --git a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected --- a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected @@ -1,7 +1,7 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // Check that the non-clang/non-filechecked runlines execute -// RUN: cp %s %S/Output/execute-all-runlines.copy.c -// RUN: cp %S/Output/execute-all-runlines.copy.c %s.copy.c +// RUN: cp %s %S/execute-all-runlines.copy.c +// RUN: cp %S/execute-all-runlines.copy.c %s.copy.c // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-pch %s -o %t diff --git a/llvm/utils/update_cc_test_checks.py b/llvm/utils/update_cc_test_checks.py --- a/llvm/utils/update_cc_test_checks.py +++ b/llvm/utils/update_cc_test_checks.py @@ -238,11 +238,8 @@ run_list = [] line2func_list = collections.defaultdict(list) - subs = { - '%s' : ti.path, - '%t' : tempfile.NamedTemporaryFile().name, - '%S' : os.getcwd(), - } + subs = common.getSubstitutions(ti.path) + subs.append(('%t', tempfile.NamedTemporaryFile().name)) for l in ti.run_lines: commands = [cmd.strip() for cmd in l.split('|')] @@ -257,16 +254,14 @@ # Execute non-clang runline. if exec_args[0] not in SUBST: # Do lit-like substitutions. - for s in subs: - exec_args = [i.replace(s, subs[s]) if s in i else i for i in exec_args] + exec_args = [common.applySubstitutions(a, subs) for a in exec_args] run_list.append((None, exec_args, None, None)) continue # This is a clang runline, apply %clang substitution rule, do lit-like substitutions, # and append args.clang_args clang_args = exec_args clang_args[0:1] = SUBST[clang_args[0]] - for s in subs: - clang_args = [i.replace(s, subs[s]) if s in i else i for i in clang_args] + clang_args = [common.applySubstitutions(a, subs) for a in clang_args] clang_args += ti.args.clang_args # Extract -check-prefix in FileCheck args