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

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Mon May 18 05:53:37 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/198290

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.

>From 1a7c5f38957d52ccbe8961ae70d60037ae5ca9ea Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Mon, 18 May 2026 14:51:39 +0200
Subject: [PATCH] [lldb][windows] Make skipUnlessMSVC tolerate cl.exe not in
 PATH

---
 lldb/packages/Python/lldbsuite/test/decorators.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

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



More information about the lldb-commits mailing list