Skip to content

Commit

Permalink
Do not require test file in a forked process in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Jan 3, 2023
1 parent 4f1267d commit 9b36ed1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 12 additions & 0 deletions test/openssl/engine_utils.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module EngineUtils
def get_engine
OpenSSL::Engine.by_id("openssl")
end

def crypt_data(data, key, mode)
cipher = yield
cipher.send mode
cipher.key = key
cipher.update(data) + cipher.final
end
end
4 changes: 2 additions & 2 deletions test/openssl/test_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def test_openssl_engine_cipher_rc4
# this is required because OpenSSL::Engine methods change global state
def with_openssl(code, **opts)
assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;", **opts)
require #{__FILE__.dump}
include OpenSSL::TestEngine::Utils
require 'engine_utils'
include EngineUtils
#{code}
end;
end
Expand Down
2 changes: 0 additions & 2 deletions test/openssl/test_fips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def test_fips_mode_is_reentrant
def test_fips_mode_get
return unless OpenSSL::OPENSSL_FIPS
assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;")
require #{__FILE__.dump}
begin
OpenSSL.fips_mode = true
assert OpenSSL.fips_mode == true, ".fips_mode returns true when .fips_mode=true"
Expand Down

0 comments on commit 9b36ed1

Please sign in to comment.