[#111712] [Ruby master Feature#19322] Support spawning "private" child processes — "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" <ruby-core@...>
SXNzdWUgIzE5MzIyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGtqdHNhbmFrdHNpZGlzIChLSiBUc2Fu
14 messages
2023/01/07
[ruby-core:111959] [Ruby master Bug#19360] Enabling coverage with `-r` option isn't sufficient to intercept top level script.
From:
"ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>
Date:
2023-01-21 21:53:17 UTC
List:
ruby-core #111959
Issue #19360 has been updated by ioquatix (Samuel Williams).
Status changed from Open to Closed
Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: REQUIRED
I've merged this fix. I would like this backported to 3.2 if possible, because it's blocking correct coverage computation and I don't want to wait a year to be able to use this fix.
----------------------------------------
Bug #19360: Enabling coverage with `-r` option isn't sufficient to intercept top level script.
https://bugs.ruby-lang.org/issues/19360#change-101393
* Author: ioquatix (Samuel Williams)
* Status: Closed
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: REQUIRED
----------------------------------------
For some reason, Ruby's coverage library doesn't work when the file is loaded from the command line. In the below example, test2.rb loads test.rb. If you run test2.rb with coverage enabled, it will report coverage for test.rb but not test2.rb. If you run test.rb directly, no coverage is reported.
```
samuel@aiko ~/P/i/autocoverage> ruby -r "./autocoverage.rb" test.rb
Hello World
{}
samuel@aiko ~/P/i/autocoverage> ruby -r "./autocoverage.rb" test2.rb
Hello World
{"/home/samuel/Projects/ioquatix/autocoverage/test.rb"=>{:lines=>[1, 1, nil, nil, 1], :branches=>{}, :methods=>{[Object, :main, 1, 0, 3, 3]=>1}}}
```
The same problem affects simplecov.
```
ruby -r "./simplecov.rb" test.rb
... similar results in coverage directory ...
```
See https://github.com/ioquatix/autocoverage for a complete reproduction.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/