Project

General

Profile

Actions

Bug #20158

open

Ractor affects Coverage results

Added by janosch-x (Janosch Müller) 4 months ago. Updated 4 months ago.

Status:
Assigned
Target version:
-
ruby -v:
ruby 3.3.0preview1 (2023-05-12 master a1b01e7701) [arm64-darwin22]
[ruby-core:116061]

Description

I have a large rspec test suite. I found that if I call a Ractor, the Coverage results are strongly affected, i.e. almost all files appear to be uncovered. This happens even if I only ever call a Ractor before the library or rspec are required.

Unfortunately, I was not able to build a simple repro yet.

I assume it is a timing thing and only affects larger suites, or it only happens if there are multiple files, and maybe if the library lazily requires its sub-modules?

However, I guess this should produce the same results when added to the spec_helper.rb of other large suites:

# Ractor.new { nil } # uncomment this to affect coverage results

require 'coverage'
Coverage.start

# require library, set up rspec etc. 

RSpec.configuration.after(:suite) do
  # this number is greatly reduced and unstable when calling Ractor above
  p Coverage.result.values.sum { |arr| arr.sum(&:to_i) }
end

I had this problem in this library. The problem affects simplecov users as well, as described here.


Related issues 1 (1 open0 closed)

Has duplicate Ruby master - Bug #20167: Code execution isn't recorded in RactorOpenActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like1