From 208ff30c076d16db2e2b6fc3f0d635b3197e7ca4 Mon Sep 17 00:00:00 2001 From: nahi Date: Mon, 20 Oct 2003 15:37:11 +0000 Subject: * test/soap/calc/*, test/soap/helloworld/*: catch the exception from test server thread and recover. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/soap/calc/test_calc.rb | 5 +++++ test/soap/calc/test_calc2.rb | 6 ++++++ test/soap/calc/test_calc_cgi.rb | 7 +++++++ test/soap/helloworld/test_helloworld.rb | 6 ++++++ 4 files changed, 24 insertions(+) (limited to 'test') diff --git a/test/soap/calc/test_calc.rb b/test/soap/calc/test_calc.rb index e3304a415b..4e50617f0c 100644 --- a/test/soap/calc/test_calc.rb +++ b/test/soap/calc/test_calc.rb @@ -22,6 +22,10 @@ class TestCalc < Test::Unit::TestCase } while @server.server.nil? or @server.server.status != :Running sleep 0.1 + unless @t.alive? + @t.join + raise + end end @calc = SOAP::RPC::Driver.new("http://localhost:#{Port}/", 'http://tempuri.org/calcService') @calc.add_method('add', 'lhs', 'rhs') @@ -33,6 +37,7 @@ class TestCalc < Test::Unit::TestCase def teardown @server.server.shutdown @t.kill + @t.join end def test_calc diff --git a/test/soap/calc/test_calc2.rb b/test/soap/calc/test_calc2.rb index 25e686b244..4675d0316b 100644 --- a/test/soap/calc/test_calc2.rb +++ b/test/soap/calc/test_calc2.rb @@ -18,10 +18,15 @@ class TestCalc2 < Test::Unit::TestCase @server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', Port) @server.level = Logger::Severity::FATAL @t = Thread.new { + Thread.current.abort_on_exception = true @server.start } while @server.server.nil? or @server.server.status != :Running sleep 0.1 + unless @t.alive? + @t.join + raise + end end @var = SOAP::RPC::Driver.new("http://localhost:#{Port}/", 'http://tempuri.org/calcService') @var.add_method('set', 'newValue') @@ -35,6 +40,7 @@ class TestCalc2 < Test::Unit::TestCase def teardown @server.server.shutdown @t.kill + @t.join end def test_calc2 diff --git a/test/soap/calc/test_calc_cgi.rb b/test/soap/calc/test_calc_cgi.rb index 0ed5849283..30cafae446 100644 --- a/test/soap/calc/test_calc_cgi.rb +++ b/test/soap/calc/test_calc_cgi.rb @@ -21,6 +21,7 @@ class TestCalcCGI < Test::Unit::TestCase def setup logger = Logger.new(STDERR) logger.level = Logger::Severity::FATAL + logger.level = Logger::Severity::DEBUG if $DEBUG @server = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", :Logger => logger, @@ -31,10 +32,15 @@ class TestCalcCGI < Test::Unit::TestCase :CGIInterpreter => RUBYBIN ) @t = Thread.new { + Thread.current.abort_on_exception = true @server.start } while @server.status != :Running sleep 0.1 + unless @t.alive? + @t.join + raise + end end @calc = SOAP::RPC::Driver.new("http://localhost:#{Port}/server.cgi", 'http://tempuri.org/calcService') @calc.add_method('add', 'lhs', 'rhs') @@ -46,6 +52,7 @@ class TestCalcCGI < Test::Unit::TestCase def teardown @server.shutdown @t.kill + @t.join end def test_calc diff --git a/test/soap/helloworld/test_helloworld.rb b/test/soap/helloworld/test_helloworld.rb index 2819f86b45..bc1937bea1 100644 --- a/test/soap/helloworld/test_helloworld.rb +++ b/test/soap/helloworld/test_helloworld.rb @@ -18,10 +18,15 @@ class TestHelloWorld < Test::Unit::TestCase @server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', Port) @server.level = Logger::Severity::UNKNOWN @t = Thread.new { + Thread.current.abort_on_exception = true @server.start } while @server.server.nil? or @server.server.status != :Running sleep 0.1 + unless @t.alive? + @t.join + raise + end end @client = SOAP::RPC::Driver.new("http://localhost:#{Port}/", 'urn:hws') @client.add_method("hello_world", "from") @@ -30,6 +35,7 @@ class TestHelloWorld < Test::Unit::TestCase def teardown @server.server.shutdown @t.kill + @t.join end def test_hello_world -- cgit v1.2.3