diff options
Diffstat (limited to 'bootstraptest/test_fork.rb')
| -rw-r--r-- | bootstraptest/test_fork.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb index 1cd9f7ac6c..860ef285d0 100644 --- a/bootstraptest/test_fork.rb +++ b/bootstraptest/test_fork.rb @@ -21,7 +21,9 @@ assert_finish 10, %q{ end }, '[ruby-core:22158]' -assert_normal_exit(<<'End', '[ruby-dev:37934]') +# temporarily stop this test to enable explicit failure when +# timer thread couldn't be created (r61706 and r61717). +assert_normal_exit(<<'End', '[ruby-dev:37934]') if false main = Thread.current Thread.new { sleep 0.01 until main.stop?; Thread.kill main } Process.setrlimit(:NPROC, 1) if defined?(Process::RLIMIT_NPROC) @@ -73,3 +75,30 @@ assert_equal '[1, 2]', %q{ end }, '[ruby-dev:44005] [Ruby 1.9 - Bug #4950]' +assert_equal 'ok', %q{ + def now = Process.clock_gettime(Process::CLOCK_MONOTONIC) + + Thread.new do + loop { sleep 0.0001 } + end + + 10.times do + pid = fork{ exit!(0) } + deadline = now + 10 + while true + _, status = Process.waitpid2(pid, Process::WNOHANG) + break if status + if now > deadline + Process.kill(:KILL, pid) + raise "failed" + end + sleep 0.001 + end + unless status.success? + raise "child exited with status #{status}" + end + rescue NotImplementedError + end + :ok +}, '[Bug #20670]' + |
