| 258 | return retval |
| 259 | |
| 260 | def test_syscall_write(ql: Qiling, fd: int, buf: int, count: int): |
| 261 | retval = syscall.ql_syscall_write(ql, fd, buf, count) |
| 262 | |
| 263 | hpath = ql.os.fd[fd].name |
| 264 | |
| 265 | if os.path.basename(hpath) == "test_syscall_write.txt": |
| 266 | mcontent = ql.mem.read(buf, count) |
| 267 | |
| 268 | with open(hpath, 'rb') as infile: |
| 269 | fcontent = infile.read() |
| 270 | |
| 271 | if ql.host.os is not QL_OS.WINDOWS: |
| 272 | os.remove(hpath) |
| 273 | |
| 274 | self.assertEqual(mcontent, fcontent) |
| 275 | checklist.append('write') |
| 276 | |
| 277 | return retval |
| 278 | |
| 279 | def test_syscall_open(ql: Qiling, path: int, flags: int, mode: int): |
| 280 | retval = syscall.ql_syscall_open(ql, path, flags, mode) |