summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-01 14:12:11 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-01 14:12:11 +0000
commit3ec72f078c207f53348809d304ba37ba5f915629 (patch)
tree5ce4b0d283cf6b75ea34bad53738acedb600ac6f /test
parentf4b417eb43468630cf4591c1768bc0c3b1378bcd (diff)
* test/openssl/utils.rb (start_server): Don't close sockets before
threads finished. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/lib/leakchecker.rb1
-rw-r--r--test/openssl/test_ssl_session.rb11
-rw-r--r--test/openssl/utils.rb33
3 files changed, 26 insertions, 19 deletions
diff --git a/test/lib/leakchecker.rb b/test/lib/leakchecker.rb
index b6ed19e9c4..5d05c1e456 100644
--- a/test/lib/leakchecker.rb
+++ b/test/lib/leakchecker.rb
@@ -66,6 +66,7 @@ class LeakChecker
end
puts "Leaked file descriptor: #{test_name}: #{fd}#{str}"
}
+ #system("lsof -p #$$") if !fd_leaked.empty?
h.each {|fd, list|
next if list.length <= 1
if 1 < list.count {|io, autoclose, inspect| autoclose }
diff --git a/test/openssl/test_ssl_session.rb b/test/openssl/test_ssl_session.rb
index 8e12105dc3..91b7455f56 100644
--- a/test/openssl/test_ssl_session.rb
+++ b/test/openssl/test_ssl_session.rb
@@ -32,11 +32,14 @@ tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
ctx.session_id_context = self.object_id.to_s
sock = TCPSocket.new '127.0.0.1', port
- ssl = OpenSSL::SSL::SSLSocket.new sock, ctx
- ssl.session = session
+ begin
+ ssl = OpenSSL::SSL::SSLSocket.new sock, ctx
+ ssl.session = session
- assert_equal session, ssl.session
- sock.close
+ assert_equal session, ssl.session
+ ensure
+ sock.close
+ end
}
end
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index e3240a0d1e..f878845354 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -299,28 +299,31 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
ssls.start_immediately = start_immediately
- server = Thread.new do
- server_loop(ctx, ssls, stop_pipe_r, ignore_ssl_accept_error, server_proc, threads)
- end
- threads.unshift server
+ begin
+ server = Thread.new do
+ server_loop(ctx, ssls, stop_pipe_r, ignore_ssl_accept_error, server_proc, threads)
+ end
+ threads.unshift server
- $stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, $$, port) if $DEBUG
+ $stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, $$, port) if $DEBUG
- th = Thread.new do
+ th = Thread.new do
+ begin
+ block.call(server, port.to_i)
+ ensure
+ stop_pipe_w.close
+ end
+ end
begin
- block.call(server, port.to_i)
- ensure
- stop_pipe_w.close
+ th.join
+ rescue Exception
+ threads.unshift th
end
- end
- begin
- th.join
- rescue Exception
- threads.unshift th
+ ensure
+ assert_join_threads(threads)
end
ensure
tcps.close if tcps
- assert_join_threads(threads)
end
}
end