|
| 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 | +// Set up a fake ROCm installation rooted at /opt/rocm in the synthetic sysroot |
| 15 | +// so that the device libraries and HIP runtime can be found. |
| 16 | +// RUN: mkdir -p %t/sysroot/opt/rocm |
| 17 | +// RUN: cp -r %S/Inputs/rocm/* %t/sysroot/opt/rocm |
| 18 | +// Copy the built clang binary so that its InstalledDir and the real path used |
| 19 | +// by the driver both reside under /opt/rocm/lib/llvm/bin, which is what the |
| 20 | +// detection logic inspects. |
| 21 | +// RUN: mkdir -p %t/sysroot/opt/rocm/lib/llvm/bin |
| 22 | +// RUN: cp %clang %t/sysroot/opt/rocm/lib/llvm/bin/clang |
| 23 | +// RUN: %t/sysroot/opt/rocm/lib/llvm/bin/clang -### --target=x86_64-linux-gnu \ |
| 24 | +// RUN: --offload-arch=gfx1010 --print-rocm-search-dirs %s 2>&1 \ |
| 25 | +// RUN: | FileCheck -check-prefixes=ROCM-LIB-LLVM %s |
| 26 | +// |
| 27 | +// ROCM-LIB-LLVM: ROCm installation search path: {{.*sysroot/opt/rocm$}} |
| 28 | +// ROCM-LIB-LLVM-NOT: ROCm installation search path: {{.*sysroot/opt/rocm/lib$}} |
0 commit comments