[Lldb-commits] [lldb] [lldb][windows] re-enable unicode tests on Windows (PR #190828)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 8 03:53:58 PDT 2026


================
@@ -480,15 +480,25 @@ def unicode_test(func):
     """Decorate the item as a test which requires Unicode to be enabled.
 
     lldb checks the value of the `LANG` environment variable for the substring "utf-8"
-    to determine if the terminal supports Unicode (except on Windows, where we assume
-    it's always supported).
+    to determine if the terminal supports Unicode (except on Windows, where stdout
+    being connected to an interactive console is used as the signal instead).
     This decorator sets LANG to `utf-8` before running the test and resets it to its
     previous value afterwards.
     """
 
     if sys.platform == "win32":
-        # Unicode support on Windows is flaky in CI.
-        return expectedFailureWindows
+        import ctypes
+
+        STD_OUTPUT_HANDLE = -11
+        FILE_TYPE_CHAR = 0x0002
+        handle = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
+        file_type = ctypes.windll.kernel32.GetFileType(handle)
+        # Mirror Terminal::SupportsUnicode(): Unicode is supported only when
+        # stdout is connected to a real console.
+        if file_type != FILE_TYPE_CHAR:
+            return unittest.skip(
+                "Unicode test requires an interactive console (stderr is redirected)"
+            )
----------------
charles-zablit wrote:

> Have you checked if we run the Unicode tests in `check-lldb-api`?

We use `unicode_tests` in `llvm-project\lldb\test\API\terminal\hidden_frame_markers\TestHiddenFrameMarkers.py` yes. The tests are not running currently.

> And if we pass this, we still add the `LANG` env variable on Windows (`unicode_wrapped`). I think we should leave that untouched.

Good catch, fixed, thanks!

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


More information about the lldb-commits mailing list