[llvm] [llvm][test][NFCI] Use absolute build path instead of a relative path (PR #159126)

Raul Tambre via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 09:45:33 PDT 2025


https://github.com/tambry created https://github.com/llvm/llvm-project/pull/159126

Scoping to the root build directory instead of using the path directly is awkward and the only such occurrence in the test suite. Pass the appropriate substitution instead for this.

**Background**
In my downstream `%llvmshlibdir` is much more nested so the single `../` is insufficient.  
But we can use a much more direct substitution rather than a round-about way, which is both cleaner and avoids me needing to patch this test.

>From 5c3184d65aecae64e010bee028d1c3444325bba7 Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul at tambre.ee>
Date: Tue, 16 Sep 2025 19:33:56 +0300
Subject: [PATCH] [llvm][test][NFCI] Use absolute build path instead of a
 relative path

Scoping to the root build directory instead of using the path directly is awkward and the only such
occurrence in the test suite. Pass the appropriate substitution instead for this.
---
 llvm/test/Other/codegen-plugin-loading.ll | 2 +-
 llvm/test/lit.cfg.py                      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/test/Other/codegen-plugin-loading.ll b/llvm/test/Other/codegen-plugin-loading.ll
index 652bbcdef36c3..a2a0814718e22 100644
--- a/llvm/test/Other/codegen-plugin-loading.ll
+++ b/llvm/test/Other/codegen-plugin-loading.ll
@@ -1,4 +1,4 @@
-; RUN: llc -load %llvmshlibdir/../unittests/CodeGen/CGPluginTest/CGTestPlugin%pluginext %s -o - | FileCheck %s
+; RUN: llc -load %llvm_obj_root/unittests/CodeGen/CGPluginTest/CGTestPlugin%pluginext %s -o - | FileCheck %s
 ; REQUIRES: native, system-linux, llvm-dylib
 
 ; CHECK: CodeGen Test Pass running on main
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index e8861e29be707..b257ca1061fbf 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -121,6 +121,7 @@ def get_asan_rtlib():
 config.substitutions.append(("%pluginext", config.llvm_plugin_ext))
 config.substitutions.append(("%exeext", config.llvm_exe_ext))
 config.substitutions.append(("%llvm_src_root", config.llvm_src_root))
+config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root))
 
 # Add IR2Vec test vocabulary path substitution
 config.substitutions.append(



More information about the llvm-commits mailing list