[Lldb-commits] [lldb] [LLDB] Fix tests windows (PR #131600)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 17 03:40:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Aleksandr Korepanov (AlexK0)
<details>
<summary>Changes</summary>
Hello,
I'm working on LLDB on Windows and have encountered some issues with the tests.
1) Many tests fail to start on Windows due to an import exception:
```
Traceback (most recent call last):
File "D:\Projects\github\llvm-project-fork\lldb\test\API\dotest.py", line 8, in <module>
lldbsuite.test.run_suite()
File "D:\Projects\github\llvm-project-fork\lldb\packages\Python\lldbsuite\test\dotest.py", line 1042, in run_suite
checkLibcxxSupport()
File "D:\Projects\github\llvm-project-fork\lldb\packages\Python\lldbsuite\test\dotest.py", line 799, in checkLibcxxSupport
result, reason = canRunLibcxxTests()
File "D:\Projects\github\llvm-project-fork\lldb\packages\Python\lldbsuite\test\dotest.py", line 770, in canRunLibcxxTests
from lldbsuite.test import lldbplatformutil
File "D:\Projects\github\llvm-project-fork\lldb\packages\Python\lldbsuite\test\lldbplatformutil.py", line 11, in <module>
from packaging import version
ModuleNotFoundError: No module named 'packaging'
```
I think this exception occurs due to missing environment variables. I fixed the test setup to use the original environment variables.
2) `file` utility is not available on Windows, so I fixed the test to use `test -d` instead.
3) There is a minor difference in the watchpoint error message on Windows.
Please take a look.
Thanks!
---
Full diff: https://github.com/llvm/llvm-project/pull/131600.diff
3 Files Affected:
- (modified) lldb/test/API/lldbtest.py (+1-1)
- (modified) lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (+12-5)
- (modified) lldb/test/Shell/Diagnostics/TestDump.test (+2-2)
``````````diff
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:
diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 7a0e42a4fc278..5f7be87322b02 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/131600
More information about the lldb-commits
mailing list