https://github.com/yxsamliu updated https://github.com/llvm/llvm-project/pull/169705
>From 25c7b7f3496d99dc34215411474ceb2d77760e38 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" <[email protected]> Date: Wed, 26 Nov 2025 13:03:24 -0500 Subject: [PATCH] [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. --- clang/test/Driver/rocm-detect-lib-llvm.hip | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 clang/test/Driver/rocm-detect-lib-llvm.hip diff --git a/clang/test/Driver/rocm-detect-lib-llvm.hip b/clang/test/Driver/rocm-detect-lib-llvm.hip new file mode 100644 index 0000000000000..9e037d87516ba --- /dev/null +++ b/clang/test/Driver/rocm-detect-lib-llvm.hip @@ -0,0 +1,24 @@ +// UNSUPPORTED: system-windows +// +// Copying clang to a new location and running it will not work unless it is +// statically linked. Dynamically linked builds typically use relative rpaths, +// which this will break. +// REQUIRES: static-libs +// +// Test detecting ROCm installation from clang installed in /opt/rocm/lib/llvm/bin. +// This exercises the RocmInstallationDetector logic that backs up from +// /opt/rocm/lib/llvm/bin to the ROCm root, while avoiding dependence on any +// real /opt/rocm installation by using a synthetic sysroot under %t. +// +// RUN: rm -rf %t/* +// RUN: mkdir -p %t/sysroot/opt/rocm/lib/llvm/bin +// Copy the built clang binary so that its InstalledDir and the real path used +// by the driver both reside under /opt/rocm/lib/llvm/bin, which is what the +// detection logic inspects. +// RUN: cp %clang %t/sysroot/opt/rocm/lib/llvm/bin/clang +// RUN: %t/sysroot/opt/rocm/lib/llvm/bin/clang -### --target=x86_64-linux-gnu \ +// RUN: --offload-arch=gfx1010 --print-rocm-search-dirs %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=ROCM-LIB-LLVM %s +// +// ROCM-LIB-LLVM: ROCm installation search path: {{.*sysroot/opt/rocm$}} +// ROCM-LIB-LLVM-NOT: ROCm installation search path: {{.*sysroot/opt/rocm/lib$}} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
