sebastian-ne created this revision.
sebastian-ne added reviewers: foad, arichardson.
sebastian-ne requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.
Use substitution methods from common.py in update_cc_test_checks.py.
Follow up to D110143 <https://reviews.llvm.org/D110143>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110612
Files:
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
llvm/utils/update_cc_test_checks.py
Index: llvm/utils/update_cc_test_checks.py
===================================================================
--- llvm/utils/update_cc_test_checks.py
+++ 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
Index:
clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ 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
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
+++ 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
Index: llvm/utils/update_cc_test_checks.py
===================================================================
--- llvm/utils/update_cc_test_checks.py
+++ 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
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected
+++ 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
Index: clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c
+++ 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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits