| 46 | self.assertEqual('child', ql.loader.argv[0]) |
| 47 | |
| 48 | def test_elf_linux_cloexec_x8664(self): |
| 49 | ql = Qiling([fr'{X64_LINUX_ROOTFS}/bin/x8664_cloexec_test'], X64_LINUX_ROOTFS, multithread=True, verbose=QL_VERBOSE.DEBUG) |
| 50 | |
| 51 | filename = 'stderr.txt' |
| 52 | err = ql_file.open(filename, os.O_RDWR | os.O_CREAT, 0o644) |
| 53 | |
| 54 | ql.os.stats = QlOsNullStats() |
| 55 | ql.os.stderr = err |
| 56 | |
| 57 | ql.run() |
| 58 | err.close() |
| 59 | |
| 60 | with open(filename, 'r') as f: |
| 61 | contents = f.readlines() |
| 62 | |
| 63 | # cleanup |
| 64 | os.remove(filename) |
| 65 | |
| 66 | self.assertGreaterEqual(len(contents), 4) |
| 67 | self.assertIn('Bad file descriptor', contents[-2]) |
| 68 | self.assertIn('Bad file descriptor', contents[-1]) |
| 69 | |
| 70 | def test_multithread_elf_linux_x86(self): |
| 71 | logged: List[str] = [] |