Tentative fix for epoll server test case

This commit is contained in:
libumem
2025-11-14 04:39:15 +00:00
parent 2ecd1d924a
commit a76b858332
3 changed files with 5 additions and 8 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ def ql_syscall_epoll_ctl(ql: Qiling, epfd: int, op: int, fd: int, event: int):
if op not in (EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD):
return -EINVAL
if epfd == fd:
if epfd == fd or fd == 0xffffffff: # latter condition was seen in testing, but should not happen in the real world
return -EINVAL
if epfd not in range(NR_OPEN):
+3 -6
View File
@@ -217,13 +217,13 @@ class ELFTest(unittest.TestCase):
ql = Qiling(["../examples/rootfs/x8664_linux/bin/x8664_hello_static"], "../examples/rootfs/x8664_linux", verbose=QL_VERBOSE.DEBUG)
ql.run()
del ql
#@unittest.skip('Experiment to avoid FD issue')
def test_elf_linux_x86(self):
filename = 'test.qlog'
ql = Qiling(["../examples/rootfs/x86_linux/bin/x86_hello"], "../examples/rootfs/x86_linux", verbose=QL_VERBOSE.DEBUG, log_devices=[filename])
ql.run()
ql._log_file_fd.handlers[0].close() # prevent FD leak that causes downstream issues
os.remove(filename)
del ql
@@ -789,8 +789,7 @@ class ELFTest(unittest.TestCase):
ql.run()
self.assertIn(b'echo\n', ql.os.stdout.read())
del ql
@unittest.skip("See comment in https://github.com/qilingframework/qiling/pull/1558")
del ql
def test_elf_linux_x8664_epoll_server(self):
# This tests a simple server that uses epoll to wait for data, then prints it out. It has
# been modified to exit after data has been received; instead of a typical server operation
@@ -810,7 +809,6 @@ class ELFTest(unittest.TestCase):
def client():
# give time for the server to listen
time.sleep(3)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 8000))
s.send(b"hello world")
@@ -826,7 +824,6 @@ class ELFTest(unittest.TestCase):
client_thread = threading.Thread(target=client, daemon=True)
client_thread.start()
ql.run()
self.assertIn(b'hello world', ql.os.stdout.read(200)) # 200 is arbitrary--"good enough" for this task
+1 -1
View File
@@ -4,7 +4,7 @@
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
python3 ./test_posix.py &&
python3 -m pdb ./test_posix.py &&
python3 ./test_elf_multithread.py &&
python3 ./test_elf_ko.py &&
python3 ./test_debugger.py &&