[Lldb-commits] [PATCH] D128042: [lldb] [test] Fix test_platform_file_fstat to account for negative ints

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 17 03:28:20 PDT 2022


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Fix test_platform_file_fstat to correctly truncate/max out the expected
value when GDB Remote Serial Protocol specifies a value as an unsigned
integer but the underlying platform type uses a signed integer.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D128042

Files:
  lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py


Index: lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
@@ -32,11 +32,11 @@
 
 
 def uint32_or_zero(x):
-    return x if x < 2**32 else 0
+    return x if x < 2**32 and x >= 0 else 0
 
 
 def uint32_or_max(x):
-    return x if x < 2**32 else 2**32 - 1
+    return x if x < 2**32 and x >= 0 else 2**32 - 1
 
 
 def uint32_trunc(x):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128042.437838.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220617/14b39dcd/attachment.bin>


More information about the lldb-commits mailing list