From 912f1cda0d2ddfb4e6a52d43952a0562cb0fb46d Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Thu, 31 Aug 2023 21:34:50 +0900 Subject: [ruby/openssl] Remove OSSL_DEBUG compile-time option Remove the OSSL_DEBUG flag and OpenSSL.mem_check_start which is only compiled when the flag is given. They are meant purely for development of Ruby/OpenSSL. OpenSSL.mem_check_start helped us find memory leak bugs in past, but it is no longer working with the recent OpenSSL versions. Let's just remove it now. https://github.com/ruby/openssl/commit/8c7a6a17e2 --- test/openssl/test_engine.rb | 2 +- test/openssl/test_fips.rb | 6 +++--- test/openssl/test_provider.rb | 2 +- test/openssl/utils.rb | 20 -------------------- 4 files changed, 5 insertions(+), 25 deletions(-) (limited to 'test') diff --git a/test/openssl/test_engine.rb b/test/openssl/test_engine.rb index 15434218d9..b6025f915b 100644 --- a/test/openssl/test_engine.rb +++ b/test/openssl/test_engine.rb @@ -82,7 +82,7 @@ class OpenSSL::TestEngine < OpenSSL::TestCase # this is required because OpenSSL::Engine methods change global state def with_openssl(code, **opts) - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;", **opts) + assert_separately(["-ropenssl"], <<~"end;", **opts) #{code} end; end diff --git a/test/openssl/test_fips.rb b/test/openssl/test_fips.rb index dfc1729b35..43042beab8 100644 --- a/test/openssl/test_fips.rb +++ b/test/openssl/test_fips.rb @@ -9,7 +9,7 @@ class OpenSSL::TestFIPS < OpenSSL::TestCase omit "Only for FIPS mode environment" end - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;") + assert_separately(["-ropenssl"], <<~"end;") assert OpenSSL.fips_mode == true, ".fips_mode should return true on FIPS mode enabled" end; end @@ -19,7 +19,7 @@ class OpenSSL::TestFIPS < OpenSSL::TestCase omit "Only for non-FIPS mode environment" end - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;") + assert_separately(["-ropenssl"], <<~"end;") message = ".fips_mode should return false on FIPS mode disabled. " \ "If you run the test on FIPS mode, please set " \ "TEST_RUBY_OPENSSL_FIPS_ENABLED=true" @@ -35,7 +35,7 @@ class OpenSSL::TestFIPS < OpenSSL::TestCase def test_fips_mode_get_with_fips_mode_set omit('OpenSSL is not FIPS-capable') unless OpenSSL::OPENSSL_FIPS - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;") + assert_separately(["-ropenssl"], <<~"end;") begin OpenSSL.fips_mode = true assert OpenSSL.fips_mode == true, ".fips_mode should return true when .fips_mode=true" diff --git a/test/openssl/test_provider.rb b/test/openssl/test_provider.rb index 3040a4be9f..d0e6678587 100644 --- a/test/openssl/test_provider.rb +++ b/test/openssl/test_provider.rb @@ -58,7 +58,7 @@ class OpenSSL::TestProvider < OpenSSL::TestCase # this is required because OpenSSL::Provider methods change global state def with_openssl(code, **opts) - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;", **opts) + assert_separately(["-ropenssl"], <<~"end;", **opts) #{code} end; end diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb index 3d4d05fe02..269a111dbf 100644 --- a/test/openssl/utils.rb +++ b/test/openssl/utils.rb @@ -4,26 +4,6 @@ begin rescue LoadError end -# Compile OpenSSL with crypto-mdebug and run this test suite with OSSL_MDEBUG=1 -# environment variable to enable memory leak check. -if ENV["OSSL_MDEBUG"] == "1" - if OpenSSL.respond_to?(:print_mem_leaks) - OpenSSL.mem_check_start - - END { - GC.start - case OpenSSL.print_mem_leaks - when nil - warn "mdebug: check what is printed" - when true - raise "mdebug: memory leaks detected" - end - } - else - warn "OSSL_MDEBUG=1 is specified but OpenSSL is not built with crypto-mdebug" - end -end - require "test/unit" require "tempfile" require "socket" -- cgit v1.2.3