+++ /dev/null
-"""This test checks for correct wait4() behavior.\r
-"""\r
-\r
-import os\r
-import time\r
-from test.fork_wait import ForkWait\r
-from test.test_support import run_unittest, reap_children, get_attribute\r
-\r
-# If either of these do not exist, skip this test.\r
-get_attribute(os, 'fork')\r
-get_attribute(os, 'wait4')\r
-\r
-\r
-class Wait4Test(ForkWait):\r
- def wait_impl(self, cpid):\r
- for i in range(10):\r
- # wait4() shouldn't hang, but some of the buildbots seem to hang\r
- # in the forking tests. This is an attempt to fix the problem.\r
- spid, status, rusage = os.wait4(cpid, os.WNOHANG)\r
- if spid == cpid:\r
- break\r
- time.sleep(1.0)\r
- self.assertEqual(spid, cpid)\r
- self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))\r
- self.assertTrue(rusage)\r
-\r
-def test_main():\r
- run_unittest(Wait4Test)\r
- reap_children()\r
-\r
-if __name__ == "__main__":\r
- test_main()\r