Skip to content

Commit 25c7b7f

Browse files
committed
[clang][Driver] Add ROCm lib/llvm/bin detection test
Add a lit test that exercises RocmInstallationDetector when clang is installed under /opt/rocm/lib/llvm/bin, using a synthetic sysroot so it does not depend on any real /opt/rocm installation. The test copies the built clang binary into the test tree so the driver observes the expected InstalledDir and real path, following the precedent of other driver tests that copy %clang into a temporary layout.
1 parent f3cce97 commit 25c7b7f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// UNSUPPORTED: system-windows
2+
//
3+
// Copying clang to a new location and running it will not work unless it is
4+
// statically linked. Dynamically linked builds typically use relative rpaths,
5+
// which this will break.
6+
// REQUIRES: static-libs
7+
//
8+
// Test detecting ROCm installation from clang installed in /opt/rocm/lib/llvm/bin.
9+
// This exercises the RocmInstallationDetector logic that backs up from
10+
// /opt/rocm/lib/llvm/bin to the ROCm root, while avoiding dependence on any
11+
// real /opt/rocm installation by using a synthetic sysroot under %t.
12+
//
13+
// RUN: rm -rf %t/*
14+
// RUN: mkdir -p %t/sysroot/opt/rocm/lib/llvm/bin
15+
// Copy the built clang binary so that its InstalledDir and the real path used
16+
// by the driver both reside under /opt/rocm/lib/llvm/bin, which is what the
17+
// detection logic inspects.
18+
// RUN: cp %clang %t/sysroot/opt/rocm/lib/llvm/bin/clang
19+
// RUN: %t/sysroot/opt/rocm/lib/llvm/bin/clang -### --target=x86_64-linux-gnu \
20+
// RUN: --offload-arch=gfx1010 --print-rocm-search-dirs %s 2>&1 \
21+
// RUN: | FileCheck -check-prefixes=ROCM-LIB-LLVM %s
22+
//
23+
// ROCM-LIB-LLVM: ROCm installation search path: {{.*sysroot/opt/rocm$}}
24+
// ROCM-LIB-LLVM-NOT: ROCm installation search path: {{.*sysroot/opt/rocm/lib$}}

0 commit comments

Comments
 (0)