[Lldb-commits] [lldb] [LLDB] Fix tests on Windows (PR #131600)

Aleksandr Korepanov via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 18 04:20:44 PDT 2025


https://github.com/AlexK0 updated https://github.com/llvm/llvm-project/pull/131600

>From 2186582c6113033a7adf2c3ac7fb1a6fcde5726c Mon Sep 17 00:00:00 2001
From: Aleksandr Korepanov <alexander.korepanov at jetbrains.com>
Date: Mon, 17 Mar 2025 11:03:57 +0100
Subject: [PATCH 1/2] [LLDB][tests] Transfer APPDATA env for running tests

On Windows without APPDATA environment variable,
the test framework cannot import the 'packaging' module.
---
 lldb/test/API/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 08cf11c8a68db..4336a89d57c5f 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -343,6 +343,6 @@ def delete_module_cache(path):
 
 # Transfer some environment variables into the tests on Windows build host.
 if platform.system() == "Windows":
-    for v in ["SystemDrive"]:
+    for v in ["SystemDrive", "APPDATA"]:
         if v in os.environ:
             config.environment[v] = os.environ[v]

>From bf21cbc2ff6325367312f106af12dd50bfd9b48b Mon Sep 17 00:00:00 2001
From: Aleksandr Korepanov <alexander.korepanov at jetbrains.com>
Date: Mon, 17 Mar 2025 11:06:46 +0100
Subject: [PATCH 2/2] [LLDB][tests] Fix tests for Windows

- On Windows there is different error message on setting watchpoint.

- Use 'test -d' to check for a directory instead of 'file' because
  Windows does not have the 'file' utility.
---
 .../watchpoint/watchlocation/TestTargetWatchAddress.py    | 8 +++-----
 lldb/test/Shell/Diagnostics/TestDump.test                 | 4 ++--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 7a0e42a4fc278..bb024e27fbda1 100644
--- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -201,8 +201,6 @@ def test_watch_address_with_invalid_watch_size(self):
                 value.GetValueAsUnsigned(), 365, wp_opts, error
             )
             self.assertFalse(watchpoint)
-            self.expect(
-                error.GetCString(),
-                exe=False,
-                substrs=["Setting one of the watchpoint resources failed"],
-            )
+            # The message depends on whether the lldb-server implementation or the in-process implementation is used.
+            self.assertRegex(error.GetCString(),
+                             "Can't enable watchpoint|Setting one of the watchpoint resources failed")
diff --git a/lldb/test/Shell/Diagnostics/TestDump.test b/lldb/test/Shell/Diagnostics/TestDump.test
index 2adde6b86d35a..cf10991d51c35 100644
--- a/lldb/test/Shell/Diagnostics/TestDump.test
+++ b/lldb/test/Shell/Diagnostics/TestDump.test
@@ -5,11 +5,11 @@
 # RUN: rm -rf %t.existing
 # RUN: mkdir -p %t.existing
 # RUN: %lldb -o 'diagnostics dump -d %t.existing'
-# RUN: file %t.existing | FileCheck %s
+# RUN: test -d %t.existing
 
 # Dump to a non-existing directory.
 # RUN: rm -rf %t.nonexisting
 # RUN: %lldb -o 'diagnostics dump -d %t.nonexisting'
-# RUN: file %t.nonexisting | FileCheck %s
+# RUN: test -d %t.nonexisting
 
 # CHECK: directory



More information about the lldb-commits mailing list