[Lldb-commits] [lldb] [LLDB] Fix tests on Windows (PR #131600)
Aleksandr Korepanov via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 17 03:45:22 PDT 2025
https://github.com/AlexK0 updated https://github.com/llvm/llvm-project/pull/131600
>From 9734adfcca5d1d5cfdba85dc0bfe76d230106c11 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] Use original env for running tests
On Windows without the original environment,
the test framework cannot import the 'packaging' module.
---
lldb/test/API/lldbtest.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/test/API/lldbtest.py b/lldb/test/API/lldbtest.py
index d6b79ebc2c434..f32c2ac61537f 100644
--- a/lldb/test/API/lldbtest.py
+++ b/lldb/test/API/lldbtest.py
@@ -63,7 +63,7 @@ def execute(self, test, litConfig):
try:
out, err, exitCode = lit.util.executeCommand(
cmd,
- env=test.config.environment,
+ env={**os.environ, **test.config.environment},
timeout=litConfig.maxIndividualTestTime,
)
except lit.util.ExecuteCommandTimeoutException as e:
>From 8f265ddd0a164455931c9ea4cec5b9664b15a304 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.
---
.../watchlocation/TestTargetWatchAddress.py | 17 ++++++++++++-----
lldb/test/Shell/Diagnostics/TestDump.test | 4 ++--
2 files changed, 14 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..ba62daa01fb51 100644
--- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -201,8 +201,15 @@ 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"],
- )
+ if self.getPlatform() == "windows":
+ self.expect(
+ error.GetCString(),
+ exe=False,
+ substrs=["Can't enable watchpoint"],
+ )
+ else:
+ self.expect(
+ error.GetCString(),
+ exe=False,
+ substrs=["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..ae29bbbb8eeb4 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 && echo "directory" | FileCheck %s
# 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 && echo "directory" | FileCheck %s
# CHECK: directory
More information about the lldb-commits
mailing list