Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require a test file in a separately run test case #591

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Jan 3, 2023

The problem:

some tests run test cases in a separate Ruby process, probably to not pollute the global namespace. To share test helpers a test file can be required in this separate process. So there need additional efforts to prevent auto-launching etc.

I propose to not require a test file and to move such shared test helpers into a separate place.

Actually there are only 2 places where a test file is required

  • test_engine.rb
  • test_fips.rb

But only in one place it's really needed (to share test helpers).

Related PR: #589

@andrykonchin andrykonchin force-pushed the fix-tests-timeout-on-truffleruby-ruby-avoid-requiring-test-file branch from 0fabee3 to 9b36ed1 Compare January 3, 2023 17:34
require #{__FILE__.dump}
include OpenSSL::TestEngine::Utils
require 'engine_utils'
include EngineUtils
#{code}
end;
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module Utils below should be removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should simply inline these helper methods in Utils. They are both too specialized and don't look very useful anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've inlined the helpers.

@andrykonchin andrykonchin requested review from rhenium and eregon and removed request for rhenium and eregon January 4, 2023 15:43
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

decrypted = crypt_data(encrypted, key, :decrypt) { OpenSSL::Cipher.new(algo) }

cipher = engine.cipher(algo)
cipher.send :encrypt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the .send necessary? (is it a private method?)
(same below)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed and squashed the commits.

@andrykonchin andrykonchin force-pushed the fix-tests-timeout-on-truffleruby-ruby-avoid-requiring-test-file branch from 9083cd5 to ae78467 Compare January 4, 2023 16:22
Copy link
Member

@rhenium rhenium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, too. Thank you!

@rhenium rhenium merged commit 08ae86d into ruby:master Jan 4, 2023
@andrykonchin andrykonchin deleted the fix-tests-timeout-on-truffleruby-ruby-avoid-requiring-test-file branch January 4, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants