[#84867] [Ruby trunk Bug#14357] thread_safe tests suite segfaults — v.ondruch@...

Issue #14357 has been reported by vo.x (Vit Ondruch).

11 messages 2018/01/15
[#85364] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults — Eric Wong <normalperson@...> 2018/02/03

v.ondruch@tiscali.cz wrote:

[#84980] [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — hsbt@...

Issue #13618 has been updated by hsbt (Hiroshi SHIBATA).

10 messages 2018/01/23
[#85012] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — Eric Wong <normalperson@...> 2018/01/23

hsbt@ruby-lang.org wrote:

[ruby-core:84862] [Ruby trunk Bug#9572] Restarting Coverage does not produce correct coverage result

From: tenderlove@...
Date: 2018-01-14 23:53:33 UTC
List: ruby-core #84862
Issue #9572 has been updated by tenderlovemaking (Aaron Patterson).


> The more important piece of the change is being able to pause and resume coverage.

Pause / Resume just seems like ignoring coverage information for some code.  This case seems like you can handle by taking snapshots around the execution you want to ignore, and doing the appropriate math.

> Especially being able to continue getting coverage results for files already required.

This might be pretty tricky.  Enabling code coverage changes the way code is compiled.  Since the code is compiled when you require it, you'd have to go back and recompile it.  Here is an example:

~~~
require 'coverage'

code = <<-eoruby
def method_a
  puts "method_a called"
end
 
def method_b
  puts "method_b_called"
end

method_a
method_b
eoruby

iseq = RubyVM::InstructionSequence.compile code
puts iseq.disasm

Coverage.start
iseq = RubyVM::InstructionSequence.compile code
puts iseq.disasm
~~~

If you run this code, you'll see that the instructions emitted are different on the second call (specifically calls like `0028 trace            131072`).  The coverage tool uses these instructions to record coverage information.  Files that have been required before the coverage tool has been enabled simply don't have these instructions.

----------------------------------------
Bug #9572: Restarting Coverage does not produce correct coverage result
https://bugs.ruby-lang.org/issues/9572#change-69576

* Author: sean_ferguson (Sean Ferguson)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-01-13 trunk 61811) [x86_64-darwin15]
* Backport: 
----------------------------------------
Feature 4796(https://www.ruby-forum.com/topic/1811306#1001864) appears
to have a bug in it.

While the test listed there does pass the following test does not:
<pre>
require "test/unit"
require "coverage"
require 'tmpdir'
class TestCoverage < Test::Unit::TestCase
  def test_restarting_coverage
    Dir.mktmpdir {|tmp|
      Dir.chdir(tmp) {
        File.open("test.rb", "w") do |f|
          f.puts <<-EOS
            def coverage_test_method
              puts :ok
            end
          EOS
        end
        Coverage.start
        require tmp + '/test.rb'
        Coverage.result
        Coverage.start
        coverage_test_method
        result = Coverage.result
        assert_equal 1, result.size
        assert_equal [0, 1, nil], result.first[1] # coverage stats show an empty array here
      }
    }
  end
end
</pre>
It appears that while the coverage is finding the correct files it is
not giving any coverage stats for those files. Knowing this information would be very helpful in determining test coverage data for individual test files. I'm not very familiar
with how the coverage library works, but if you can point me at where to
look I can give fixing it a try.

Thanks,

Sean Ferguson



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next