Skip to content

[2.7] bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055)#3071

Merged
vstinner merged 1 commit into
python:2.7from
vstinner:subprocess_stopped27
Aug 11, 2017
Merged

[2.7] bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055)#3071
vstinner merged 1 commit into
python:2.7from
vstinner:subprocess_stopped27

Conversation

@vstinner

@vstinner vstinner commented Aug 11, 2017

Copy link
Copy Markdown
Member

The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dc)

https://bugs.python.org/issue31173

The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dc)
@vstinner vstinner merged commit 4dea065 into python:2.7 Aug 11, 2017
@vstinner vstinner deleted the subprocess_stopped27 branch August 11, 2017 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants