[Lldb-commits] [lldb] d3292c4 - [lldb] [test] Fix test_platform_file_fstat to account for negative ints

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 20 10:42:34 PDT 2022


Author: Michał Górny
Date: 2022-06-20T19:42:22+02:00
New Revision: d3292c4ba0ce13edb316d7fb63ccae376081a102

URL: https://github.com/llvm/llvm-project/commit/d3292c4ba0ce13edb316d7fb63ccae376081a102
DIFF: https://github.com/llvm/llvm-project/commit/d3292c4ba0ce13edb316d7fb63ccae376081a102.diff

LOG: [lldb] [test] Fix test_platform_file_fstat to account for negative ints

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
Differential Revision: https://reviews.llvm.org/D128042

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
index 57b2daf96143..fec1e95fa28c 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
@@ -32,11 +32,11 @@ class GDBStat(typing.NamedTuple):
 
 
 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):


        


More information about the lldb-commits mailing list