Use sleep 0.5
for tests of GVL instrumentation API
The tests fail randomly on some platforms. http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20220605T213004Z.fail.html.gz http://rubyci.s3.amazonaws.com/arch/ruby-master/log/20220605T210003Z.fail.html.gz ``` [15737/21701] TestThreadInstrumentation#test_thread_instrumentation_fork_safe/home/chkbuild/chkbuild/tmp/build/20220605T213004Z/ruby/tool/lib/test/unit/assertions.rb:109:in `assert': Expected 0 to be nonzero?. (Test::Unit::AssertionFailedError) ``` The failures seem to depend on context switches. I suspect `sleep 0.05` is too short, so this change tries to extend the wait time.
This commit is contained in:
parent
5267829641
commit
5d014bcb61
@ -10,7 +10,7 @@ class TestThreadInstrumentation < Test::Unit::TestCase
|
||||
Bug::ThreadInstrumentation::register_callback
|
||||
|
||||
begin
|
||||
threads = 5.times.map { Thread.new { sleep 0.05; 1 + 1; sleep 0.02 } }
|
||||
threads = 5.times.map { Thread.new { sleep 0.5; 1 + 1; sleep 0.2 } }
|
||||
threads.each(&:join)
|
||||
Bug::ThreadInstrumentation.counters.each do |c|
|
||||
assert_predicate c,:nonzero?
|
||||
@ -29,7 +29,7 @@ class TestThreadInstrumentation < Test::Unit::TestCase
|
||||
begin
|
||||
pid = fork do
|
||||
Bug::ThreadInstrumentation.reset_counters
|
||||
threads = 5.times.map { Thread.new { sleep 0.05; 1 + 1; sleep 0.02 } }
|
||||
threads = 5.times.map { Thread.new { sleep 0.5; 1 + 1; sleep 0.2 } }
|
||||
threads.each(&:join)
|
||||
Bug::ThreadInstrumentation.counters.each do |c|
|
||||
assert_predicate c,:nonzero?
|
||||
|
Loading…
x
Reference in New Issue
Block a user