[compiler-rt] [ctx_profile] Fix integration test when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=Off` (PR #92679)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Sat May 18 23:43:35 PDT 2024


https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/92679

When `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=Off` the library name has the architecture part of its name.

>From d2a1688df4fdd4667926030202b98555b69a708c Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Sat, 18 May 2024 23:41:06 -0700
Subject: [PATCH] [ctx_profile] Fix integration test when
 `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=Off`

---
 .../test/ctx_profile/TestCases/generate-context.cpp  |  2 +-
 compiler-rt/test/ctx_profile/lit.cfg.py              | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/test/ctx_profile/TestCases/generate-context.cpp b/compiler-rt/test/ctx_profile/TestCases/generate-context.cpp
index 981d6170091c5..4f7c5f86afbab 100644
--- a/compiler-rt/test/ctx_profile/TestCases/generate-context.cpp
+++ b/compiler-rt/test/ctx_profile/TestCases/generate-context.cpp
@@ -5,7 +5,7 @@
 // RUN: cp %llvm_src/include/llvm/ProfileData/CtxInstrContextNode.h %t_include/
 //
 // Compile with ctx instrumentation "on". We treat "theRoot" as callgraph root.
-// RUN: %clangxx %s -lclang_rt.ctx_profile -I%t_include -O2 -o %t.bin -mllvm -profile-context-root=theRoot
+// RUN: %clangxx %s %libctxprof -I%t_include -O2 -o %t.bin -mllvm -profile-context-root=theRoot
 //
 // Run the binary, and observe the profile fetch handler's output.
 // RUN: %t.bin | FileCheck %s
diff --git a/compiler-rt/test/ctx_profile/lit.cfg.py b/compiler-rt/test/ctx_profile/lit.cfg.py
index bf62093601f11..ee8c5c39a031d 100644
--- a/compiler-rt/test/ctx_profile/lit.cfg.py
+++ b/compiler-rt/test/ctx_profile/lit.cfg.py
@@ -33,3 +33,15 @@ def get_required_attr(config, attr_name):
 config.substitutions.append(
     ("%clangxx ", " ".join([config.clang] + config.cxx_mode_flags) + " -ldl -lpthread ")
 )
+
+config.substitutions.append(
+    (
+        "%libctxprof",
+        " ".join(
+            [
+                f"-lclang_rt.ctx_profile{config.target_suffix}",
+                f"-L{config.compiler_rt_libdir}",
+            ]
+        ),
+    )
+)



More information about the llvm-commits mailing list