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):


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):
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D12... Michał Górny via Phabricator via lldb-commits

Reply via email to