Author: dyung
Date: 2026-06-06T17:15:04-07:00
New Revision: baa69e929b67543682452e9d9f9ebbd76790ad42

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

LOG: Updating test clang/test/Driver/driverkit-path.c for usage with 
CLANG_RESOURCE_DIR (#197154)

When the CMake option CLANG_RESOURCE_DIR is specified, it changes 
the path to various tools and thus breaks some tests that look for things
in the "standard" location. This change updates one of the tests to take
into account the CLANG_RESOURCE_DIR value if specified by querying
compiler using `-print-resource-dir` to more accurately find the expected
directory in tests.

Added: 
    

Modified: 
    clang/test/Driver/driverkit-path.c
    clang/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/driverkit-path.c 
b/clang/test/Driver/driverkit-path.c
index bc96201753165..a2fa06f47ea2e 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -25,15 +25,15 @@ int main() { return 0; }
 
 
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -isysroot 
%S/Inputs/DriverKit19.0.sdk -x c++ -### 2>&1 \
-// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit19.0.sdk --check-prefix=INC
+// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit19.0.sdk 
-DRESOURCE_DIR=%clang-resource-dir --check-prefix=INC
 // RUN: %clang %s -target x86_64-apple-driverkit21.0.1 -isysroot 
%S/Inputs/DriverKit21.0.1.sdk -x c++ -### 2>&1 \
-// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit21.0.1.sdk 
--check-prefix=INC
+// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit21.0.1.sdk 
-DRESOURCE_DIR=%clang-resource-dir --check-prefix=INC
 // RUN: %clang %s -target x86_64-apple-driverkit23.0 -isysroot 
%S/Inputs/DriverKit23.0.sdk -x c++ -### 2>&1 \
-// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit23.0.sdk --check-prefix=INC
+// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit23.0.sdk 
-DRESOURCE_DIR=%clang-resource-dir --check-prefix=INC
 //
 // INC: "-isysroot" "[[SDKROOT]]"
 // INC: "-internal-isystem" "[[SDKROOT]]/System/DriverKit/usr/local/include"
-// INC: "-internal-isystem" "{{.+}}/lib{{(64)?}}/clang/{{[^/ ]+}}/include"
+// INC: "-internal-isystem" "[[RESOURCE_DIR]]/include"
 // INC: "-internal-externc-isystem" "[[SDKROOT]]/System/DriverKit/usr/include"
 // INC: "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/Frameworks"
 // INC: "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/SubFrameworks"

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 17e318ba9d282..fbf92e500975f 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -420,6 +420,13 @@ def calculate_arch_features(arch_string):
 if config.enable_threads:
     config.available_features.add("thread_support")
 
+# Add clang resource directory as a substitution
+if config.clang:
+    clang_resource_dir = subprocess.run(
+        [config.clang, "-print-resource-dir"], stdout=subprocess.PIPE, 
text=True
+    ).stdout.rstrip()
+    config.substitutions.append(("%clang-resource-dir", clang_resource_dir))
+
 # Check if we should allow outputs to console.
 run_console_tests = int(lit_config.params.get("enable_console", "0"))
 if run_console_tests != 0:


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to