[llvm] update_test_checks: recognize %if in RUN line (PR #108972)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 05:43:19 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Elvina Yakubova (ElvinaYakubova)

<details>
<summary>Changes</summary>

Recognize %if for target-specific cases in RUN line and keep only tool command with options

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


1 Files Affected:

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


``````````diff
diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py
index 16f3e618770b20..4bcc501f4d04a3 100755
--- a/llvm/utils/update_test_checks.py
+++ b/llvm/utils/update_test_checks.py
@@ -123,7 +123,13 @@ def main():
                 common.warn("Skipping unparsable RUN line: " + l)
                 continue
 
-            commands = [cmd.strip() for cmd in l.split("|")]
+            cropped_content = l
+            if "%if" in l:
+                match = re.search(r'%{\s*(.*?)\s*%}', l)
+                if match:
+                    cropped_content = match.group(1)
+
+            commands = [cmd.strip() for cmd in cropped_content.split("|")]
             assert len(commands) >= 2
             preprocess_cmd = None
             if len(commands) > 2:

``````````

</details>


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


More information about the llvm-commits mailing list