GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-119273: Don't run test_ioctl in a process group (#119275) · estyxx/cpython@e2d80b1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/test/libregrtest
    • run_workers.py
    • worker.py
  • Misc/NEWS.d/next/Tests
    • 2024-05-20-18-06-31.gh-issue-119273.hf-yhX.rst
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/test/libregrtest/run_workers.py‎

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/run_workers.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,20 @@ def _kill(self) -> None:
142142
return
143143
self._killed = True
144144

145-
if USE_PROCESS_GROUP:
145+
use_killpg = USE_PROCESS_GROUP
146+
if use_killpg:
147+
parent_sid = os.getsid(0)
148+
sid = os.getsid(popen.pid)
149+
use_killpg = (sid != parent_sid)
150+
151+
if use_killpg:
146152
what = f"{self} process group"
147153
else:
148154
what = f"{self} process"
149155

150156
print(f"Kill {what}", file=sys.stderr, flush=True)
151157
try:
152-
if USE_PROCESS_GROUP:
158+
if use_killpg:
153159
os.killpg(popen.pid, signal.SIGKILL)
154160
else:
155161
popen.kill()
Collapse file

‎Lib/test/libregrtest/worker.py‎

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/worker.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515

1616
USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))
17+
NEED_TTY = set('''
18+
test_ioctl
19+
'''.split())
1720

1821

1922
def create_worker_process(runtests: WorkerRunTests, output_fd: int,
@@ -47,7 +50,10 @@ def create_worker_process(runtests: WorkerRunTests, output_fd: int,
4750
close_fds=True,
4851
cwd=work_dir,
4952
)
50-
if USE_PROCESS_GROUP:
53+
54+
# Don't use setsid() in tests using TTY
55+
test_name = runtests.tests[0]
56+
if USE_PROCESS_GROUP and test_name not in NEED_TTY:
5157
kwargs['start_new_session'] = True
5258

5359
# Pass json_file to the worker process
Collapse file

‎Misc/NEWS.d/next/Tests/2024-05-20-18-06-31.gh-issue-119273.hf-yhX.rst‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Python test runner no longer runs tests using TTY (ex: test_ioctl) in a
2+
process group (using ``setsid()``). Previously, tests using TTY were
3+
skipped. Patch by Victor Stinner.

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.