Python test runner no longer runs tests using TTY (ex: test_ioctl) in
a process group (using setsid()). Previously, tests using TTY were
skipped.
return
self._killed = True
- if USE_PROCESS_GROUP:
+ use_killpg = USE_PROCESS_GROUP
+ if use_killpg:
+ parent_sid = os.getsid(0)
+ sid = os.getsid(popen.pid)
+ use_killpg = (sid != parent_sid)
+
+ if use_killpg:
what = f"{self} process group"
else:
what = f"{self} process"
print(f"Kill {what}", file=sys.stderr, flush=True)
try:
- if USE_PROCESS_GROUP:
+ if use_killpg:
os.killpg(popen.pid, signal.SIGKILL)
else:
popen.kill()
USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))
+NEED_TTY = set('''
+ test_ioctl
+'''.split())
def create_worker_process(runtests: WorkerRunTests, output_fd: int,
close_fds=True,
cwd=work_dir,
)
- if USE_PROCESS_GROUP:
+
+ # Don't use setsid() in tests using TTY
+ test_name = runtests.tests[0]
+ if USE_PROCESS_GROUP and test_name not in NEED_TTY:
kwargs['start_new_session'] = True
# Pass json_file to the worker process
--- /dev/null
+Python test runner no longer runs tests using TTY (ex: test_ioctl) in a
+process group (using ``setsid()``). Previously, tests using TTY were
+skipped. Patch by Victor Stinner.