You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to update rubygem-concurrent-ruby package in Fedora, I am facing issues like this:
An error occurred while loading ./spec/concurrent/atomic/atomic_boolean_spec.rb.
Failure/Error:
RSpec.describe CAtomicBoolean do
it_should_behave_like :atomic_boolean
end
NameError:
uninitialized constant Concurrent::CAtomicBoolean
# ./spec/concurrent/atomic/atomic_boolean_spec.rb:146:in '<module:Concurrent>'
# ./spec/concurrent/atomic/atomic_boolean_spec.rb:107:in '<top (required)>'
An error occurred while loading ./spec/concurrent/atomic/atomic_fixnum_spec.rb.
Failure/Error:
RSpec.describe CAtomicFixnum do
it_should_behave_like :atomic_fixnum
end
Looking into why this happes for 1.3.5 while it was working fine for 1.1.9, I have arrived at this commit. And this point out that no matter what, the test suite now expects to have the C extension around. However that is not the case for plain concurrent-ruby gem.
Is there a chance to somehow untangle the concurrent-ruby, concurrent-ruby-ext and concurrent-ruby-edge projects?
Long term, I believe it would be useful to reorganize the test suite in a way that there are two test runs, one with the C ext loaded while the other without.
Because in my limited understanding there probably might be merit for case where C ext is not allowed for some reason despite being allowed. But the intent is not clear. The test suite should not be that fuzzy allowing such changes unnoticed
It's enough to run bundle exec rake spec without bundle exec rake compile to trigger that case, that's how I repro'd the failure.
Feel free to make a PR adding such a run in CI.
Activity
voxik commentedon Jan 22, 2025
Looking closer, this is the problematic code introduced by the commit I reference above:
concurrent-ruby/spec/concurrent/atomic/atomic_boolean_spec.rb
Lines 145 to 149 in dbfbc14
The problem is this condition:
Concurrent.allow_c_extensions?which evaluates totrueon MRI, but that does not mean the C ext is loaded.eregon commentedon Jan 27, 2025
Right, so it should be
if Concurrent.c_extensions_loaded?instead, fixed.voxik commentedon Jan 28, 2025
Thx for the fix.
Long term, I believe it would be useful to reorganize the test suite in a way that there are two test runs, one with the C ext loaded while the other without.
Because in my limited understanding there probably might be merit for case where C ext is not allowed for some reason despite being allowed. But the intent is not clear. The test suite should not be that fuzzy allowing such changes unnoticed
eregon commentedon Jan 28, 2025
It's enough to run
bundle exec rake specwithoutbundle exec rake compileto trigger that case, that's how I repro'd the failure.Feel free to make a PR adding such a run in CI.
eregon commentedon Jan 28, 2025
Added in #1081
Fix guards in specs using C extension classes