summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn W Higgins <wishdev@gmail.com>2020-07-21 10:50:16 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-24 21:32:14 +0900
commitb8fdd38b2e01abcfd4cc8d007a3b3afb285f5ddb (patch)
tree40420b0208fb6f4993c9f6d6d8283b96d7a3b860 /test
parent4715a24dd277515077af441c1d31aeb2431917f5 (diff)
[ruby/webrick] Fix shutdown_pipe test issue
https://github.com/ruby/webrick/commit/9676704c60
Diffstat (limited to 'test')
-rw-r--r--test/webrick/test_server.rb29
1 files changed, 20 insertions, 9 deletions
diff --git a/test/webrick/test_server.rb b/test/webrick/test_server.rb
index aa40a72b0c..abe1ecca39 100644
--- a/test/webrick/test_server.rb
+++ b/test/webrick/test_server.rb
@@ -162,15 +162,26 @@ class TestWEBrickServer < Test::Unit::TestCase
end
def test_shutdown_pipe
- pipe = IO.pipe
- server = WEBrick::GenericServer.new(
- :ShutdownPipe => pipe,
- :BindAddress => '0.0.0.0',
- :Port => 0,
- :Logger => WEBrick::Log.new([], WEBrick::BasicLog::WARN))
- server_thread = Thread.start { server.start }
- pipe.last.puts('')
- assert_join_threads([server_thread])
+ loop_count = 0
+ server_threads = []
+ loop do
+ loop_count += 1
+ break if loop_count == 11
+
+ pipe = IO.pipe
+ server = WEBrick::GenericServer.new(
+ :ShutdownPipe => pipe,
+ :BindAddress => '0.0.0.0',
+ :Port => 0,
+ :Logger => WEBrick::Log.new([], WEBrick::BasicLog::WARN))
+ server_threads << Thread.start { server.start }
+ sleep 0.1 until server.status == :Running || !server_threads.last.status
+ if server_threads.last.status
+ pipe.last.puts('')
+ break
+ end
+ end
+ assert_join_threads(server_threads)
end
def test_port_numbers