aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-12-15 16:56:56 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-12-15 17:11:38 +0900
commit33a67ac96492828c1ea9d88e011da417d4ce7170 (patch)
tree9e21aded21367be4cec5ef02e086bf1f38f94101
parent44294c43425be1af44e5de6d9a879cdbba1c6f33 (diff)
downloadruby-openssl-33a67ac96492828c1ea9d88e011da417d4ce7170.tar.gz
test/utils: disable Thread's report_on_exception in start_server
Those threads can purposefully raise exceptions when they call 'pend'. The report_on_exception feature can be safely disabled in this case since we use assert_join_threads that captures all exceptions raised. This is necessary to suppress warnings on Ruby 2.5, which enables the report_on_exception feature by default.
-rw-r--r--test/utils.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/utils.rb b/test/utils.rb
index 4331d8bd..b7ddd891 100644
--- a/test/utils.rb
+++ b/test/utils.rb
@@ -216,6 +216,10 @@ class OpenSSL::SSLTestCase < OpenSSL::TestCase
threads = []
begin
server_thread = Thread.new do
+ if Thread.method_defined?(:report_on_exception=) # Ruby >= 2.4
+ Thread.current.report_on_exception = false
+ end
+
begin
loop do
begin
@@ -229,6 +233,10 @@ class OpenSSL::SSLTestCase < OpenSSL::TestCase
end
th = Thread.new do
+ if Thread.method_defined?(:report_on_exception=)
+ Thread.current.report_on_exception = false
+ end
+
begin
server_proc.call(ctx, ssl)
ensure
@@ -244,6 +252,10 @@ class OpenSSL::SSLTestCase < OpenSSL::TestCase
end
client_thread = Thread.new do
+ if Thread.method_defined?(:report_on_exception=)
+ Thread.current.report_on_exception = false
+ end
+
begin
block.call(port)
ensure