[Lldb-commits] [lldb] 620738e - [lldb-dap][test] Fix `readMemory` test (#109057)

via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 18 07:16:36 PDT 2024


Author: Adrian Vogelsgesang
Date: 2024-09-18T16:16:31+02:00
New Revision: 620738e66260f00f08808b3e676a697fc32db92e

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

LOG: [lldb-dap][test] Fix `readMemory` test (#109057)

So far, the test case was also testing the offset -1. This test cases
failed if the string is immediately at the beginning of the memory
region, though, and the offset -1 hence belonged to a different memory
region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap,
anyway. As such, this commit simply removes the corresponding test case.

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
index 3d8aaeda7f4b85..1082541aebcf7c 100644
--- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
+++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
@@ -74,10 +74,6 @@ def test_memory_refs_set_variable(self):
             ].keys(),
         )
 
-    # lldb-dap assumes that all reads will be within the same region. On Windows
-    # the target string is at the very start of a region so the -1 offset causes
-    # the read to only read from the previous region and only return 1 byte.
-    @skipIfWindows
     def test_readMemory(self):
         """
         Tests the 'readMemory' request
@@ -104,10 +100,6 @@ def test_readMemory(self):
         mem = self.dap_server.request_readMemory(memref, 2, 3)["body"]
         self.assertEqual(b64decode(mem["data"]), b"ad\0")
 
-        # Use a negative offset
-        mem = self.dap_server.request_readMemory(memref, -1, 6)["body"]
-        self.assertEqual(b64decode(mem["data"])[1:], b"dead\0")
-
         # Reads of size 0 are successful
         # VS-Code sends those in order to check if a `memoryReference` can actually be dereferenced.
         mem = self.dap_server.request_readMemory(memref, 0, 0)


        


More information about the lldb-commits mailing list