Skip to content

The test suite is centered about the CI #1080

Closed

Description

@voxik

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?

Activity

  1. voxik commented on Jan 22, 2025

    @voxik
    ContributorAuthor

    Looking closer, this is the problematic code introduced by the commit I reference above:

    if Concurrent.allow_c_extensions?
    RSpec.describe CAtomicBoolean do
    it_should_behave_like :atomic_boolean
    end
    end

    The problem is this condition: Concurrent.allow_c_extensions? which evaluates to true on MRI, but that does not mean the C ext is loaded.

  2. eregon commented on Jan 27, 2025

    @eregon
    Member

    Right, so it should be if Concurrent.c_extensions_loaded? instead, fixed.

  3. voxik commented on Jan 28, 2025

    @voxik
    ContributorAuthor

    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

  4. eregon commented on Jan 28, 2025

    @eregon
    Member

    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.

  5. eregon commented on Jan 28, 2025

    @eregon
    Member

    Added in #1081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions