]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3071)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 11 Aug 2017 12:38:37 +0000 (14:38 +0200)
committerGitHub <noreply@github.com>
Fri, 11 Aug 2017 12:38:37 +0000 (14:38 +0200)
commit4dea06531ece28dffc1452de2694fb22e99b45f9
tree918a74e4290ddd99867f44307e0fe8c4f220e4ad
parent1247e2cda514d7a73187e0b53ec8c35d87a34a84
bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3071)

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 7b7c6dcfff6a35333988a3c74c895ed19dff2e09)
Lib/test/test_subprocess.py
Modules/_testcapimodule.c