+++ /dev/null
-"""This test checks for correct wait3() behavior.\r
-"""\r
-\r
-import os\r
-import time\r
-import unittest\r
-from test.fork_wait import ForkWait\r
-from test.test_support import run_unittest, reap_children\r
-\r
-try:\r
- os.fork\r
-except AttributeError:\r
- raise unittest.SkipTest, "os.fork not defined -- skipping test_wait3"\r
-\r
-try:\r
- os.wait3\r
-except AttributeError:\r
- raise unittest.SkipTest, "os.wait3 not defined -- skipping test_wait3"\r
-\r
-class Wait3Test(ForkWait):\r
- def wait_impl(self, cpid):\r
- for i in range(10):\r
- # wait3() 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.wait3(os.WNOHANG)\r
- if spid == cpid:\r
- break\r
- time.sleep(1.0)\r
-\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(Wait3Test)\r
- reap_children()\r
-\r
-if __name__ == "__main__":\r
- test_main()\r