Project

General

Profile

Actions

Bug #20167

open

Code execution isn't recorded in Ractor

Added by shia (Sangyong Sim) 11 months ago. Updated 11 months ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:116104]

Description

reproduction code

# frozen-string-literal: true

require "coverage"

Coverage.start

require_relative "./some_lib"
# # some_lib.rb
# class C
#   def hoge(i)
#     i
#   end
# end

r = Ractor.new do
  loop do
    v = Ractor.receive
    ret_v = C.new.hoge(v)

    Ractor.yield ret_v
  end
end

2.times do |i|
  r << i
  r.take
end

Coverage.result.each do |file, lines|
  if file.include?("some_ractor_lib")
    if lines == [1, 1, 2, nil, nil]
      puts "OK"
    else
      puts "expected: [1, 1, 2, nil, nil]"
      puts "actual: #{lines.inspect}"
    end
  end
end

Target ruby version

3.2.0+ affected


Related issues 1 (1 open0 closed)

Is duplicate of Ruby master - Bug #20158: Ractor affects Coverage resultsAssignedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0