[clang] [clang][test] Use ToolSubst for spirv-tools lit substitutions (PR #192906)

Arseniy Obolenskiy via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 20 00:35:46 PDT 2026


https://github.com/aobolensk created https://github.com/llvm/llvm-project/pull/192906

Bare-string substitutions match as substrings and the replacement path contains the tool name, causing corrupted RUN lines

The issue is reproducible, for example, when path to llvm has tool name substring at any point

Based on change for llvm tests: https://github.com/llvm/llvm-project/pull/192462

>From 704763592a2445f9708e427c0609d30917bbd96b Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Mon, 20 Apr 2026 09:34:47 +0200
Subject: [PATCH] [clang][test] Use ToolSubst for spirv-tools lit substitutions

Bare-string substitutions match as substrings and the replacement path contains the tool name, causing corrupted RUN lines

The issue is reproducible, for example, when path to llvm has tool name substring at any point

Based on change for llvm tests: https://github.com/llvm/llvm-project/pull/192462
---
 clang/test/Tooling/lit.local.cfg | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/test/Tooling/lit.local.cfg b/clang/test/Tooling/lit.local.cfg
index 46d32e6ebf454..9cda4b31e81da 100644
--- a/clang/test/Tooling/lit.local.cfg
+++ b/clang/test/Tooling/lit.local.cfg
@@ -5,7 +5,7 @@ if not config.root.clang_staticanalyzer:
 
 if config.spirv_tools_tests:
     config.available_features.add("spirv-tools")
-    config.substitutions.append(("spirv-dis", os.path.join(config.llvm_tools_dir, "spirv-dis")))
-    config.substitutions.append(("spirv-val", os.path.join(config.llvm_tools_dir, "spirv-val")))
-    config.substitutions.append(("spirv-as", os.path.join(config.llvm_tools_dir, "spirv-as")))
-    config.substitutions.append(("spirv-link", os.path.join(config.llvm_tools_dir, "spirv-link")))
+    from lit.llvm import llvm_config
+    llvm_config.add_tool_substitutions(
+        ["spirv-dis", "spirv-val", "spirv-as", "spirv-link"]
+    )



More information about the cfe-commits mailing list