[Lldb-commits] [lldb] [lldb][windows] Make skipUnlessMSVC tolerate cl.exe not in PATH (PR #198290)

via lldb-commits lldb-commits at lists.llvm.org
Mon May 18 05:54:25 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

If `cl.exe` is not in the PATH, `subprocess.run([\"cl.exe\"])` raises `FileNotFoundError`. This marks the test as `UNRESOLVED` instead of `SKIPPED`.

This patch makes sure lit catches `FileNotFoundError` so the test is skipped cleanly.

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+8-5) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index e0567e99e16b7..9df99d9130316 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -1132,11 +1132,14 @@ def skipUnlessMSVC(func):
     """Decorate the item to skip test unless msvc is available."""
 
     def is_msvc_in_path():
-        result = subprocess.run(
-            ["cl.exe"],
-            capture_output=True,
-            text=True,
-        )
+        try:
+            result = subprocess.run(
+                ["cl.exe"],
+                capture_output=True,
+                text=True,
+            )
+        except FileNotFoundError:
+            return f"Test requires MSVC to be in the Path."
         if result.returncode != 0:
             return f"Test requires MSVC to be in the Path."
         return None

``````````

</details>


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


More information about the lldb-commits mailing list