(self)
| 512 | self.assertTrue(msg.endswith(f'{num} return {num}.')) |
| 513 | |
| 514 | def test_udp_elf_linux_armeb(self): |
| 515 | logged: List[str] = [] |
| 516 | |
| 517 | def check_write(ql: Qiling, fd: int, write_buf, count: int): |
| 518 | if fd == 2: |
| 519 | content = ql.mem.read(write_buf, count) |
| 520 | |
| 521 | logged.extend(content.decode().splitlines()) |
| 522 | |
| 523 | ql = Qiling([fr'{ARMEB_LINUX_ROOTFS}/bin/armeb_udp_test', '20014'], ARMEB_LINUX_ROOTFS, multithread=True, verbose=QL_VERBOSE.DEBUG) |
| 524 | |
| 525 | ql.os.stats = QlOsNullStats() |
| 526 | ql.os.set_syscall("write", check_write, QL_INTERCEPT.ENTER) |
| 527 | ql.run() |
| 528 | |
| 529 | self.assertGreaterEqual(len(logged), 2) |
| 530 | self.assertTrue(logged[-2].startswith('server recvfrom()')) |
| 531 | self.assertTrue(logged[-1].startswith('server sendto()')) |
| 532 | |
| 533 | # the server is expected to send the value it received, for example: |
| 534 | # 'server recvfrom() return 14.\n' |
| 535 | # 'server sendto() 14 return 14.\n' |
| 536 | |
| 537 | m = re.search(r'(?P<num>\d+)\.\Z', logged[-2]) |
| 538 | self.assertIsNotNone(m, f'could not extract numeric value from log message "{logged[-2]}"') |
| 539 | |
| 540 | num = m.group('num') |
| 541 | msg = logged[-1].strip() |
| 542 | |
| 543 | self.assertTrue(msg.endswith(f'{num} return {num}.')) |
| 544 | |
| 545 | def test_http_elf_linux_x8664(self): |
| 546 | PORT = 20020 |
nothing calls this directly
no test coverage detected