[llvm-branch-commits] [UTC] Strip only standalone positional %s in update_test_checks.py (PR #221153)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 4 00:12:18 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Previously, update_test_checks.py used tool_cmd_args.replace("%s", "")
to strip the input file when passing the IR via stdin. However, this
blindly removed "%s" from any option argument (such as
-lowertypetests-read-summary=%s or other pass options taking %s), leaving
an empty value and causing the tool to fail to load expected input files.

Update the argument stripping to only remove standalone positional
"< %s" or "%s", preserving option arguments with "%s" values so they can
be expanded via common substitutions.

Assisted-by: Gemini


---
Full diff: https://github.com/llvm/llvm-project/pull/221153.diff


1 Files Affected:

- (modified) llvm/utils/update_test_checks.py (+2-1) 


``````````diff
diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py
index 5d8d7a36f5273..25b8c282e9cf0 100755
--- a/llvm/utils/update_test_checks.py
+++ b/llvm/utils/update_test_checks.py
@@ -72,7 +72,8 @@ def update_test(ti: common.TestInfo):
             continue
 
         tool_cmd_args = tool_cmd[len(tool_basename) :].strip()
-        tool_cmd_args = tool_cmd_args.replace("< %s", "").replace("%s", "").strip()
+        tool_cmd_args = re.sub(r"(?:^|\s)< %s(?=\s|$)", "", tool_cmd_args)
+        tool_cmd_args = re.sub(r"(?:^|\s)%s(?=\s|$)", "", tool_cmd_args).strip()
         check_prefixes = common.get_check_prefixes(filecheck_cmd)
 
         # FIXME: We should use multiple check prefixes to common check lines. For

``````````

</details>


https://github.com/llvm/llvm-project/pull/221153


More information about the llvm-branch-commits mailing list