diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-06-06 12:52:15 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2022-06-06 12:52:15 +0900 |
commit | 5d014bcb61cbc443be6e6bd722573bf9e482a9be (patch) | |
tree | 8ef802f3386592921683ea86c54b5494ebdf0ac1 | |
parent | 5267829641aad24c8dd66436fcdcbddd3cf30589 (diff) | |
download | ruby-5d014bcb61cbc443be6e6bd722573bf9e482a9be.tar.gz |
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.
-rw-r--r-- | test/-ext-/thread/test_instrumentation_api.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/-ext-/thread/test_instrumentation_api.rb b/test/-ext-/thread/test_instrumentation_api.rb index 9f3f3601a6..08bcda7ed9 100644 --- a/test/-ext-/thread/test_instrumentation_api.rb +++ b/test/-ext-/thread/test_instrumentation_api.rb @@ -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? |