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

Method test_tcp_elf_linux_mips32el

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

Source from the content-addressed store, hash-verified

388 self.assertTrue(msg.endswith(f'{num} return {num}.'))
389
390 def test_tcp_elf_linux_mips32el(self):
391 logged: List[str] = []
392
393 def check_write(ql: Qiling, fd: int, write_buf, count: int):
394 if fd == 2:
395 content = ql.mem.read(write_buf, count)
396
397 logged.extend(content.decode().splitlines())
398
399 ql = Qiling([fr'{MIPSEL_LINUX_ROOTFS}/bin/mips32el_tcp_test', '20006'], MIPSEL_LINUX_ROOTFS, multithread=True, verbose=QL_VERBOSE.DEBUG)
400
401 ql.os.stats = QlOsNullStats()
402 ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER)
403 ql.run()
404
405 self.assertGreaterEqual(len(logged), 2)
406 self.assertTrue(logged[-2].startswith('server read()'))
407 self.assertTrue(logged[-1].startswith('server write()'))
408
409 # the server is expected to send the value it received, for example:
410 # 'server read() return 14.\n'
411 # 'server write() 14 return 14.\n'
412
413 m = re.search(r'(?P<num>\d+)\.\Z', logged[-2])
414 self.assertIsNotNone(m, f'could not extract numeric value from log message "{logged[-2]}"')
415
416 num = m.group('num')
417 msg = logged[-1].strip()
418
419 self.assertTrue(msg.endswith(f'{num} return {num}.'))
420
421 def test_udp_elf_linux_x86(self):
422 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