def test_unaligned_mappings(self):
     # This test ensures that mapping file contents at non page-aligned offsets is possible.
     filename = os.path.join(os.path.dirname(__file__), 'binaries', 'basic_linux_amd64')
     with open(filename, 'rb') as f:
         for addr, size in [
             (0x0001, 0xfffe), (0x0001, 0x0fff), (0x0001, 0x1000),
             (0x0fff, 0x0001), (0x0fff, 0x0002), (0x0fff, 0x1000),
         ]:
             # No assert should be triggered on the following line
             munmap(mmap(f.fileno(), addr, size), size)
예제 #2
0
 def test_unaligned_mappings(self) -> None:
     # This test ensures that mapping file contents at non page-aligned offsets is possible.
     filename = os.path.join(os.path.dirname(__file__), "binaries", "basic_linux_amd64")
     with open(filename, "rb") as f:
         for addr, size in [
             (0x0001, 0xFFFE),
             (0x0001, 0x0FFF),
             (0x0001, 0x1000),
             (0x0FFF, 0x0001),
             (0x0FFF, 0x0002),
             (0x0FFF, 0x1000),
         ]:
             # No assert should be triggered on the following line
             munmap(mmap(f.fileno(), addr, size), size)