Skip to content

Commit 722c39f

Browse files
committed
[HIP] Tighten checks in hip-include-path.hip test case
The checks (both positive and negative checks) in the test case hip-include-path.hip could mistakenly end up matching the string "clang" from the InstalledDir in case the build dir for example was named "/home/username/build-clang/". Intention with this patch is to tighten up the checks a bit to filter our the part of the paths that match with InstalledDir when doing the checks, as well as matching "/lib/clang/" rather than just "clang/". Problem was found when building with -DCLANG_DEFAULT_RTLIB=compiler-rt -DCLANG_DEFAULT_CXX_STDLIB=libc++ and having "clang/" in the path to the build dir. Reviewed By: yaxunl Differential Revision: https://reviews.llvm.org/D102723
1 parent 8c2b535 commit 722c39f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

clang/test/Driver/hip-include-path.hip

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,40 @@
1616
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nogpuinc -nogpulib %s 2>&1 \
1717
// RUN: | FileCheck -check-prefixes=COMMON,CLANG,NOHIP %s
1818

19+
// COMMON: InstalledDir: [[ROOT:[^"]*]]/bin
20+
1921
// COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
20-
// CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include/cuda_wrappers"
21-
// NOCLANG-NOT: "{{.*}}clang/{{.*}}/include/cuda_wrappers"
22+
// CLANG-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{.*}}/include/cuda_wrappers"
23+
// NOCLANG-NOT: "[[ROOT]]/lib/clang/{{.*}}/include/cuda_wrappers"
2224
// HIP-SAME: "-internal-isystem" "{{.*}}Inputs/rocm/include"
2325
// NOHIP-NOT: "{{.*}}Inputs/rocm/include"
2426
// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
2527
// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
2628
// skip check of standard C++ include path
27-
// CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include"
28-
// NOCLANG-NOT: "{{.*}}clang/{{.*}}/include"
29+
// CLANG-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{.*}}/include"
30+
// NOCLANG-NOT: "[[ROOT]]/lib/clang/{{.*}}/include"
2931

3032
// COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
31-
// CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include/cuda_wrappers"
32-
// NOCLANG-NOT: "{{.*}}clang/{{.*}}/include/cuda_wrappers"
33+
// CLANG-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{.*}}/include/cuda_wrappers"
34+
// NOCLANG-NOT: "[[ROOT]]/lib/clang/{{.*}}/include/cuda_wrappers"
3335
// HIP-SAME: "-internal-isystem" "{{.*}}Inputs/rocm/include"
3436
// NOHIP-NOT: "{{.*}}Inputs/rocm/include"
3537
// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
3638
// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
3739
// skip check of standard C++ include path
38-
// CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include"
39-
// NOCLANG-NOT: "{{.*}}clang/{{.*}}/include"
40+
// CLANG-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{.*}}/include"
41+
// NOCLANG-NOT: "[[ROOT]]/lib/clang/{{.*}}/include"
4042

4143
// RUN: %clang -c -### -target x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \
4244
// RUN: -std=c++11 --rocm-path=%S/Inputs/rocm -nogpulib %s 2>&1 \
4345
// RUN: --hip-version=3.5 | FileCheck -check-prefixes=ROCM35 %s
4446

47+
// ROCM35: InstalledDir: [[ROOT:[^"]*]]/bin
48+
4549
// ROCM35-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
46-
// ROCM35-NOT: "{{.*}}clang/{{.*}}/include/cuda_wrappers"
47-
// ROCM35-SAME: "-internal-isystem" "{{[^"]*}}clang/{{[^"]*}}"
50+
// ROCM35-NOT: "[[ROOT]]/lib/clang/{{.*}}/include/cuda_wrappers"
51+
// ROCM35-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{[^"]*}}"
4852
// ROCM35-SAME: "-internal-isystem" "{{[^"]*}}Inputs/rocm/include"
4953
// ROCM35-NOT: "-include" "__clang_hip_runtime_wrapper.h"
5054
// skip check of standard C++ include path
51-
// ROCM35-SAME: "-internal-isystem" "{{[^"]*}}clang/{{[^"]*}}/include"
55+
// ROCM35-SAME: "-internal-isystem" "[[ROOT]]/lib/clang/{{.*}}/include"

0 commit comments

Comments
 (0)