https://github.com/DeanSturtevant1 updated https://github.com/llvm/llvm-project/pull/182130
>From af55c0105d58b74b0d424e9187d9613c78a5797f Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Wed, 18 Feb 2026 15:33:28 -0500 Subject: [PATCH 1/6] [SYCL][Driver] Fix #174877 test to be driver-path-agnostic. --- clang/test/Driver/sycl-offload-jit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 5bdb56d935a98..7e4a027fb8b73 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -31,11 +31,11 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. -// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s -// CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include" -// CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include" -// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ +// RUN: | FileCheck -DDRIVER_DIR=$(basename $(dirname %clang)) -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s +// CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" +// CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" +// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" /// Check -fsycl-is-device is passed when compiling for the device. /// Check -fsycl-is-host is passed when compiling for host. >From bb541d71b520af8ca4527cb7b206e9cfcb6c144a Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Wed, 18 Feb 2026 16:15:35 -0500 Subject: [PATCH 2/6] Quote a FileCheck argument. --- clang/test/Driver/sycl-offload-jit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 7e4a027fb8b73..8be6d8c59488d 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -32,7 +32,7 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ -// RUN: | FileCheck -DDRIVER_DIR=$(basename $(dirname %clang)) -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s +// RUN: | FileCheck -DDRIVER_DIR="$(basename $(dirname %clang))" -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s // CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" // CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" // CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" >From bfeba946644e4e0149da4eea3b0cc8fe7fe1f852 Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Wed, 18 Feb 2026 17:08:24 -0500 Subject: [PATCH 3/6] Trying to use a DRIVER_DIR env variable. --- clang/test/Driver/sycl-offload-jit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 8be6d8c59488d..1fae9cc625754 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -31,8 +31,9 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. +// RUN: DRIVER_DIR=$(basename $(dirname %clang)) // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ -// RUN: | FileCheck -DDRIVER_DIR="$(basename $(dirname %clang))" -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s +// RUN: | FileCheck -DDRIVER_DIR=${DRIVER_DIR} -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s // CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" // CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" // CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" >From 5eab6998b422ef1a09f7963daf461e75df491973 Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Wed, 18 Feb 2026 17:31:47 -0500 Subject: [PATCH 4/6] Quote command. --- clang/test/Driver/sycl-offload-jit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 1fae9cc625754..2ca634ab8fcb1 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -31,7 +31,7 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. -// RUN: DRIVER_DIR=$(basename $(dirname %clang)) +// RUN: DRIVER_DIR="$(basename $(dirname %clang))" // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ // RUN: | FileCheck -DDRIVER_DIR=${DRIVER_DIR} -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s // CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" >From abd027102510e72c1babcb775c9810fd7c87834e Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Thu, 19 Feb 2026 10:32:17 -0500 Subject: [PATCH 5/6] Use sed for sub-path extraction. --- clang/test/Driver/sycl-offload-jit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 2ca634ab8fcb1..d5e513406a765 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -31,7 +31,8 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. -// RUN: DRIVER_DIR="$(basename $(dirname %clang))" +// RUN: DRIVER_DIR="$(echo %clang | sed 's|/[^/]*$||; s|.*/||')" +// RUN: echo DRIVER_DIR=$DRIVER_DIR // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ // RUN: | FileCheck -DDRIVER_DIR=${DRIVER_DIR} -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s // CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" >From a8af4564b3e9908c2fa4138591154101ec2f6eab Mon Sep 17 00:00:00 2001 From: Dean Sturtevant <[email protected]> Date: Thu, 19 Feb 2026 16:05:37 -0500 Subject: [PATCH 6/6] Modify lit config to provide %clang_dir and use that. Also name the variable CLANG_DIR instead of DRIVER_DIR. --- clang/test/Driver/sycl-offload-jit.cpp | 12 ++++++------ llvm/utils/lit/lit/llvm/config.py | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index d5e513406a765..8654526ef7f7b 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -31,13 +31,13 @@ // Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. -// RUN: DRIVER_DIR="$(echo %clang | sed 's|/[^/]*$||; s|.*/||')" -// RUN: echo DRIVER_DIR=$DRIVER_DIR +// RUN: CLANG_DIR=%clang_dir +// RUN: echo CLANG_DIR=$CLANG_DIR // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ -// RUN: | FileCheck -DDRIVER_DIR=${DRIVER_DIR} -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s -// CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" -// CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}include" -// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}[[DRIVER_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" +// RUN: | FileCheck -DCLANG_DIR=${CLANG_DIR} -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s +// CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}[[CLANG_DIR]]{{[/\\]+}}..{{[/\\]+}}include" +// CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}[[CLANG_DIR]]{{[/\\]+}}..{{[/\\]+}}include" +// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}[[CLANG_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" /// Check -fsycl-is-device is passed when compiling for the device. /// Check -fsycl-is-host is passed when compiling for host. diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py index 8b794c6978890..26fb7dbda06ef 100644 --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -786,6 +786,7 @@ def use_clang( ] self.add_tool_substitutions(tool_substitutions) self.config.substitutions.append(("%resource_dir", builtin_include_dir)) + self.config.substitutions.append(("%clang_dir", os.path.dirname(self.config.clang)) # FIXME: Find nicer way to prohibit this. def prefer(this, to): _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
