Project

General

Profile

Actions

Bug #22018

closed

ISeq created via `RubyVM::InstructionSequence.compile` don't support coverage

Bug #22018: ISeq created via `RubyVM::InstructionSequence.compile` don't support coverage

Added by byroot (Jean Boussier) 21 days ago. Updated 15 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:125377]

Description

Reproduction:

require "coverage"

File.write("/tmp/a.rb", <<~RUBY)
  module CoverableRaw
    def self.call
      "cover up"
    end
  end

  CoverableRaw.call
RUBY

Coverage.start
require "/tmp/a.rb"
p Coverage.result

File.write("/tmp/b.rb", <<~RUBY)
  module Coverable
    def self.call
      "cover up"
    end
  end

  Coverable.call
RUBY

class RubyVM::InstructionSequence
  def self.load_iseq(path)
    compile_file(path)
  end
end

Coverage.start
require "/tmp/b.rb"
p Coverage.result

Expected:

{"/tmp/a.rb" => [1, 1, 1, nil, nil, nil, 1]}
{"/tmp/b.rb" => [1, 1, 1, nil, nil, nil, 1]}

Actual:

{"/tmp/a.rb" => [1, 1, 1, nil, nil, nil, 1]}
{}

Patch: https://github.com/ruby/ruby/pull/16805

Updated by byroot (Jean Boussier) 16 days ago Actions #1

  • Status changed from Open to Closed

Applied in changeset git|8bf6d7bfcb4ca46d2cfe73bdbce2fdb0652b1aae.


Fix coverage support for RubyVM::ISeq.compile

[Bug #22018]

ISeq returned by RubyVM::InstructionSequene.load_iseq weren't
handled by the coverage module.

Updated by nagachika (Tomoyuki Chikanaga) 15 days ago Actions #3 [ruby-core:125410]

  • Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: DONE, 4.0: REQUIRED

Updated by byroot (Jean Boussier) 15 days ago Actions #4

  • Backport changed from 3.3: WONTFIX, 3.4: DONE, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: DONE, 4.0: DONE
Actions

Also available in: PDF Atom