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

Load extension ('json/ext') consistently in test_ext #536

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

aeroastro
Copy link
Contributor

@aeroastro aeroastro commented Aug 14, 2023

Summary

This patch fixes the issue that rake test does not actually test
C extension for CRuby.

The Bug

The test task is defined as follows:

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L109-L110

This invokes :test_pure and :test_ext consecutively.

:test_pure assigns ENV['JSON'] = 'pure' as follows:

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L97-L98

However, :test_ext for CRuby does not change ENV['JSON'].

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L252

This lead to require 'json/pure' in test_helper.rb, which test only the pure version.

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/tests/test_helper.rb#L2-L4

How to Fix It

I have added :set_env_ext to guarantee that :test_ext assigns ENV['JSON'] = 'ext'.
This is just like test_ext in JRuby version

@hsbt hsbt merged commit 66950ee into ruby:master Sep 13, 2023
47 of 65 checks passed
@aeroastro aeroastro deleted the feature/fix-running-ext-test branch September 14, 2023 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants