MCPcopy Create free account
hub / github.com/qilingframework/qiling / test_tcp_elf_linux_armeb

Method test_tcp_elf_linux_armeb

tests/test_elf_multithread.py:328–357  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

326 self.assertTrue(msg.endswith(f'{num} return {num}.'))
327
328 def test_tcp_elf_linux_armeb(self):
329 logged: List[str] = []
330
331 def check_write(ql: Qiling, fd: int, write_buf, count: int):
332 if fd == 2:
333 content = ql.mem.read(write_buf, count)
334
335 logged.extend(content.decode().splitlines())
336
337 ql = Qiling([fr'{ARMEB_LINUX_ROOTFS}/bin/armeb_tcp_test', '20004'], ARMEB_LINUX_ROOTFS, multithread=True, verbose=QL_VERBOSE.DEBUG)
338
339 ql.os.stats = QlOsNullStats()
340 ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER)
341 ql.run()
342
343 self.assertGreaterEqual(len(logged), 2)
344 self.assertTrue(logged[-2].startswith('server recv()'))
345 self.assertTrue(logged[-1].startswith('server send()'))
346
347 # the server is expected to send the value it received, for example:
348 # 'server recv() return 14.\n'
349 # 'server send() 14 return 14.\n'
350
351 m = re.search(r'(?P<num>\d+)\.\Z', logged[-2])
352 self.assertIsNotNone(m, f'could not extract numeric value from log message "{logged[-2]}"')
353
354 num = m.group('num')
355 msg = logged[-1].strip()
356
357 self.assertTrue(msg.endswith(f'{num} return {num}.'))
358
359 def test_tcp_elf_linux_mips32eb(self):
360 logged: List[str] = []

Callers

nothing calls this directly

Calls 5

runMethod · 0.95
QilingClass · 0.90
QlOsNullStatsClass · 0.90
set_syscallMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected