1 """This test checks for correct wait4() behavior.
6 from test
.fork_wait
import ForkWait
7 from test
.test_support
import run_unittest
, reap_children
, get_attribute
9 # If either of these do not exist, skip this test.
10 get_attribute(os
, 'fork')
11 get_attribute(os
, 'wait4')
14 class Wait4Test(ForkWait
):
15 def wait_impl(self
, cpid
):
17 # wait4() shouldn't hang, but some of the buildbots seem to hang
18 # in the forking tests. This is an attempt to fix the problem.
19 spid
, status
, rusage
= os
.wait4(cpid
, os
.WNOHANG
)
23 self
.assertEqual(spid
, cpid
)
24 self
.assertEqual(status
, 0, "cause = %d, exit = %d" % (status
&0xff, status
>>8))
25 self
.assertTrue(rusage
)
28 run_unittest(Wait4Test
)
31 if __name__
== "__main__":