From 33a67ac96492828c1ea9d88e011da417d4ce7170 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 15 Dec 2017 16:56:56 +0900 Subject: 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. --- test/utils.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') 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 -- cgit v1.2.3