[clang] 062b1ae - Reapply [Utils] Fix %S substitution

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 07:15:50 PDT 2022


Author: Nikita Popov
Date: 2022-03-21T15:15:34+01:00
New Revision: 062b1ae7e0ca61c81b0f8d097279268336a7efd7

URL: https://github.com/llvm/llvm-project/commit/062b1ae7e0ca61c81b0f8d097279268336a7efd7
DIFF: https://github.com/llvm/llvm-project/commit/062b1ae7e0ca61c81b0f8d097279268336a7efd7.diff

LOG: Reapply [Utils] Fix %S substitution

%S refers to the directory of %s, not to the cwd. This is mostly
handled correctly, but update_cc_test_checks.py used the wrong
path for non-FileCheck RUN lines.

Reapplying this with a fix for an update_cc_test_checks test that
was based on cwd semantics.

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
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
index 60d608b8caddb..751568adc281f 100644
--- 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/../Output/execute-all-runlines.copy.c
+// RUN: cp %S/../Output/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
index cebd3846b2d93..4006bfca01cb4 100644
--- 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/../Output/execute-all-runlines.copy.c
+// RUN: cp %S/../Output/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
index 1299efd46a772..d4fd0935bb779 100755
--- a/llvm/utils/update_cc_test_checks.py
+++ b/llvm/utils/update_cc_test_checks.py
@@ -241,7 +241,7 @@ def main():
     subs = {
       '%s' : ti.path,
       '%t' : tempfile.NamedTemporaryFile().name,
-      '%S' : os.getcwd(),
+      '%S' : os.path.dirname(ti.path),
     }
 
     for l in ti.run_lines:


        


More information about the cfe-commits mailing list