MCPcopy Create free account
hub / github.com/bloomberg/pystack / test_map_permissions

Function test_map_permissions

tests/unit/test_maps.py:134–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132
133
134def test_map_permissions():
135 # GIVEN
136
137 map_text = """
1387f1ac1e2b000-7f1ac1e50000 r--- 00000000 08:12 8398159 /usr/lib/libc-2.31.so
1397f1ac1e2b000-7f1ac1e50000 rw-- 00000000 08:12 8398159 /usr/lib/libc-2.31.so
1407f1ac1e2b000-7f1ac1e50000 rwx- 00000000 08:12 8398159 /usr/lib/libc-2.31.so
1417f1ac1e2b000-7f1ac1e50000 rwxp 00000000 08:12 8398159 /usr/lib/libc-2.31.so
142 """
143
144 # WHEN
145
146 with patch("builtins.open", mock_open(read_data=map_text)):
147 maps = list(generate_maps_for_process(1))
148
149 # THEN
150
151 assert maps == [
152 VirtualMap(
153 start=139752898736128,
154 end=139752898887680,
155 filesize=151552,
156 offset=0,
157 device="08:12",
158 flags="r---",
159 inode=8398159,
160 path=Path("/usr/lib/libc-2.31.so"),
161 ),
162 VirtualMap(
163 start=139752898736128,
164 end=139752898887680,
165 filesize=151552,
166 offset=0,
167 device="08:12",
168 flags="rw--",
169 inode=8398159,
170 path=Path("/usr/lib/libc-2.31.so"),
171 ),
172 VirtualMap(
173 start=139752898736128,
174 end=139752898887680,
175 filesize=151552,
176 offset=0,
177 device="08:12",
178 flags="rwx-",
179 inode=8398159,
180 path=Path("/usr/lib/libc-2.31.so"),
181 ),
182 VirtualMap(
183 start=139752898736128,
184 end=139752898887680,
185 filesize=151552,
186 offset=0,
187 device="08:12",
188 flags="rwxp",
189 inode=8398159,
190 path=Path("/usr/lib/libc-2.31.so"),
191 ),

Callers

nothing calls this directly

Calls 2

VirtualMapClass · 0.90

Tested by

no test coverage detected