summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-05 03:02:33 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-05 03:02:33 +0000
commit44fc3d08eb3cb52df5bdd91a0d9723718654b349 (patch)
tree0034ca54aa0fbb3d6f4c46f2a0405ea20e3d23b9 /test/ruby
parentb3799b93c20c00865c1bd5885890291c0874f029 (diff)
unrevert r63852 but keep SIGCHLD path disabled for win32
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...) on that platform will never conflict with mjit use of waitpid. In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h so it can be easy for Linux/BSD users to test (hopefully!) win32-compatible code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_optimization.rb2
-rw-r--r--test/ruby/test_process.rb12
-rw-r--r--test/ruby/test_rubyoptions.rb17
3 files changed, 20 insertions, 11 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index 6bfaf11d7f..32bdcef13d 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -707,7 +707,7 @@ class TestRubyOptimization < Test::Unit::TestCase
end
def test_clear_unreachable_keyword_args
- assert_separately [], <<-END, timeout: 20
+ assert_separately [], <<-END, timeout: 30
script = <<-EOS
if true
else
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 36ae94908a..6a32702b03 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1426,7 +1426,6 @@ class TestProcess < Test::Unit::TestCase
end
def test_wait_without_arg
- skip "[Bug #14867]" if RubyVM::MJIT.enabled?
with_tmpchdir do
write_file("foo", "sleep 0.1")
pid = spawn(RUBY, "foo")
@@ -1435,7 +1434,6 @@ class TestProcess < Test::Unit::TestCase
end
def test_wait2
- skip "[Bug #14867]" if RubyVM::MJIT.enabled?
with_tmpchdir do
write_file("foo", "sleep 0.1")
pid = spawn(RUBY, "foo")
@@ -1444,7 +1442,6 @@ class TestProcess < Test::Unit::TestCase
end
def test_waitall
- skip "[Bug #14867]" if RubyVM::MJIT.enabled?
with_tmpchdir do
write_file("foo", "sleep 0.1")
ps = (0...3).map { spawn(RUBY, "foo") }.sort
@@ -1459,7 +1456,9 @@ class TestProcess < Test::Unit::TestCase
def test_wait_exception
bug11340 = '[ruby-dev:49176] [Bug #11340]'
t0 = t1 = nil
- IO.popen([RUBY, '-e', 'puts;STDOUT.flush;Thread.start{gets;exit};sleep(3)'], 'r+') do |f|
+ sec = 3
+ code = "puts;STDOUT.flush;Thread.start{gets;exit};sleep(#{sec})"
+ IO.popen([RUBY, '-e', code], 'r+') do |f|
pid = f.pid
f.gets
t0 = Time.now
@@ -1473,10 +1472,11 @@ class TestProcess < Test::Unit::TestCase
th.kill.join
end
t1 = Time.now
+ diff = t1 - t0
+ assert_operator(diff, :<, sec,
+ ->{"#{bug11340}: #{diff} seconds to interrupt Process.wait"})
f.puts
end
- assert_operator(t1 - t0, :<, 3,
- ->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"})
end
def test_abort
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index d67cdcb984..edd44ca0ae 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -1,6 +1,7 @@
# -*- coding: us-ascii -*-
require 'test/unit'
+require 'timeout'
require 'tmpdir'
require 'tempfile'
require_relative '../lib/jit_support'
@@ -590,14 +591,18 @@ class TestRubyOptions < Test::Unit::TestCase
pid = spawn(EnvUtil.rubybin, "test-script")
ps = nil
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ stop = now + 30
begin
sleep 0.1
ps = `#{PSCMD.join(' ')} #{pid}`
break if /hello world/ =~ ps
- end until Process.wait(pid, Process::WNOHANG)
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ end until Process.wait(pid, Process::WNOHANG) || now > stop
assert_match(/hello world/, ps)
+ assert_operator now, :<, stop
Process.kill :KILL, pid
- Process.wait(pid)
+ Timeout.timeout(5) { Process.wait(pid) }
end
end
@@ -616,14 +621,18 @@ class TestRubyOptions < Test::Unit::TestCase
pid = spawn(EnvUtil.rubybin, "test-script")
ps = nil
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ stop = now + 30
begin
sleep 0.1
ps = `#{PSCMD.join(' ')} #{pid}`
break if /hello world/ =~ ps
- end until Process.wait(pid, Process::WNOHANG)
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ end until Process.wait(pid, Process::WNOHANG) || now > stop
assert_match(/hello world/, ps)
+ assert_operator now, :<, stop
Process.kill :KILL, pid
- Process.wait(pid)
+ Timeout.timeout(5) { Process.wait(pid) }
end
end