-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JRuby support #86
Comments
After some more work on this I found the problem with the 100% coverage being reported. Seems that Jruby does not indicate which lines are not code lines vs which lines are code and not run. So all code lines not run are nil in the coverage array coming back from jruby. I tried to do some modifications to the gem to detect which lines are code and set them to 0, and this partiall works, but needs more work to cover all test cases, since my simple fix doesn't work for lines of code the span across a single line. I filed a bug with JRuby to fix this, which would be the best, but not sure if that will happen. I will look more into how I can figure out what lines are valid lines of code that can be run to mark as 0 from nil. Here if the link to the JRuby bug: http://jira.codehaus.org/browse/JRUBY-6106 |
Thanks for looking into this! Back when initial 1.9 support arrived in JRuby 1.6 RC1, I had a look into this but then realized the Coverage library was not included yet. I've removed the jruby_float_fix in the new release 0.5.4, so at least this obstacle is out of the way. I currently don't really have time to dig further into this, but I'd gladly merge any pull requests that lead to JRuby support. From what you've explained it seems to me as if the Coverage library in JRuby needs to be brought to full compatibility with MRI's one. Working around this in SimpleCov might be possible, but I think this is something the Ruby impl needs to supply. |
@headius Has recently further investigated this and noted his findings in JRuby's bugtracker. Seems this isn't going to happen any time soon. Keeping this open though as a reminder to follow eventual new developments on that. |
There have recently been further changes to get this going in JRuby, see the aforementioned http://jira.codehaus.org/browse/JRUBY-6106, but it seems it does not work with SimpleCov just yet. Getting there though :) |
If anyone's interested, here is my updated bug report (or rather experience report) - feel free to chime in! |
What's the status on 1.7.0? |
The issue hasn't been touched since I reported my experience to the initial try by the great @headius (thanks). I'll try to give it another shot with 1.7.0. Thought about digging into the implementation myself, but I want to do a lot of things and I guess it's hard to get into with a minimal knowledge of interpreters and JRuby itself. So don't count on me ;-) |
Seems to be working correctly with 1.7. Thank you so much @headius! Happy testing everyone! |
Can I get an update on this from anyone. I'd like to test this out but I can't seem to set the debug flag.
Is there something, syntactically, that I am doing wrong here? |
The feature shipped with jruby 1.7 and it works beautifully for us. This should be closed. |
Is the command you are using similar to the one I posted above? I'm still getting the warning on jruby-1.7.3 |
confirmed issue goes away using jruby-1.7.2 built with --1.9 --disable-binary |
@BrandonMathis "bundle exec" launches a new subprocess, but does not pass along flags from the original command. Try env var JRUBY_OPTS=--debug instead. |
Yeah, it seems to be working pretty nicely now (on 1.7.3). I also finally managed to get the Cucumber integration suite to behave this week, leading to passing travis builds. Unfortunately the JRuby 1.9 integration suite is incredibly slow, around 25 minutes on travis (see here for example). The MRI 1.9 builds only take around 5 minutes. I already tried some of the things suggested in this blog post by Charles, but mostly to no avail. The main trouble is that the cukes need to shell out and run a billion of test/spec processes, which is very expensive on JRuby. In addition, I'm using the Aruba gem for the shell interaction steps, and that uses some flavor of @headius Do you happen to have some further advice on how I could get the runtime of the cucumber suite down? |
However, I am still getting a bundle of |
build times out on travis after 50 mins due to the massive process running being slow on JRuby :( See #86
So is there a safe way to turn off these scads of "Warning: coverage data provided by Coverage ..." warnings safely, when using JRuby? I also asked this Q on this issue thread: #98 (comment) |
Okay, trying one last 'ping' here... So do we just have to live with the 'exceeds number of lines' warnings on JRuby when using simplecov? If there's no other solution to fixing it properly, is there at least a way to turn off just this one warning easily (and not miss any other warnings besides the 'Coverage exceeds number of lines' warning)? @BrandonMathis have you found a solution, or are you just "living with" the long list of warnings you're getting? Thanks all. |
At the moment I am just living with the issues, we only use coverage in our CI box so no one on my team is very motivated to look much further into this. Since it's been a few months I would just close this issue out and I will alert you if I see any changes in my environment. |
I have the same issue with JRuby 1.7.4 and SimpleCov 1.8.0pre. |
I really think this issue should be closed as it works with JRuby and just fine at that. For reference, we are not seeing issues with exceeds number of lines or something at shoes (recent travis build for reference). Using 0.7.1 |
I've had a quick delve into the code tonight and, for me at least, it is only throwing this error on haml files. I suspect this is due to them being converted to html during the test, but don't know this for sure yet. Will have a proper look tomorrow. The line causing the issue is:
lib/simplecov/source_file.rb:90 |
Ah. Interesting. Yes, I can confirm that we're also using haml (on jruby) in our app that spews out all of these warnings. (Thanks for your reply on the status too, Brandon.) |
So simply adding this configuration block to the SimpleCov.start method has solved the issue for me:
Obviously this means that no view output is in the coverage report, but the view test we have is just a background check to ensure I18n translations are in place so I can live with that. Happy to carry on digging tomorrow though to see what is different between running on ruby 2.0 and jruby. :) |
I added |
@BrandonMathis I'm still intrigued as to why this works fine on MRI but not JRuby, so I'll have a play about when I get a spare minute and do a comparison :) |
👍 for fixing this 😃 |
I dont see any fix for this problem with jruby 1.7.10 Warning: coverage data provided by Coverage exceeds ... |
see #226 jruby/jruby#1196 https://jira.codehaus.org/browse/JRUBY-6106 simplecov-ruby/simplecov#86 Travis ENV modified per http://docs.travis-ci.com/user/ci-environment/#Environment-variables @enebo https://twitter.com/tom_enebo/status/462289024107814914 recommended JRUBY_OPTS="-Xcli.debug=true" but that didn't work and caused other failures JRUBY_OPTS="--debug" Still produced the below error, as did JRUBY_OPTS="--debug -Xcli.debug=true" Failure message was home/travis/build/metricfu/metric_fu/gemfiles/vendor/bundle/jruby/1.9/gems/simplecov-0.8.2/lib/simplecov.rb:31 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag SimpleCov::Formatter::MetricFu calculates the same coverage from an RCov report as from SimpleCov Failure/Error: expect(source_file.coverage.count).to eq(covered_lines_from_rcov_text.count) expected: 11 got: 8 (compared using ==) # /home/travis/build/metricfu/metric_fu/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb:52:in `(root)' # /home/travis/build/metricfu/metric_fu/spec/support/timeout.rb:6:in `(root)'
see #226 jruby/jruby#1196 https://jira.codehaus.org/browse/JRUBY-6106 simplecov-ruby/simplecov#86 Travis ENV modified per http://docs.travis-ci.com/user/ci-environment/#Environment-variables @enebo https://twitter.com/tom_enebo/status/462289024107814914 recommended JRUBY_OPTS="-Xcli.debug=true" but that didn't work and caused other failures JRUBY_OPTS="--debug" Still produced the below error, as did JRUBY_OPTS="--debug -Xcli.debug=true" Failure message was home/travis/build/metricfu/metric_fu/gemfiles/vendor/bundle/jruby/1.9/gems/simplecov-0.8.2/lib/simplecov.rb:31 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag SimpleCov::Formatter::MetricFu calculates the same coverage from an RCov report as from SimpleCov Failure/Error: expect(source_file.coverage.count).to eq(covered_lines_from_rcov_text.count) expected: 11 got: 8 (compared using ==) # /home/travis/build/metricfu/metric_fu/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb:52:in `(root)' # /home/travis/build/metricfu/metric_fu/spec/support/timeout.rb:6:in `(root)'
+1 The "exceeds number of lines" warning is being printed to stdout 3 times per view file. jruby-1.7.22 UPDATE: I have deleted the coverage/ directory several times to make sure I'm starting in a clean state. Didn't help. |
@betesh Last comment is from over two years ago. Please open a new issue. In that issue, please mention if you're attended to the JRUBY_OPTS recommendations. |
I could open a new issue, but it would just link back to this one, as this one has all the details. Not sure what the benefit is of opening a new issue for the same problem. Was this issue partially solved?
When I use |
Jruby 1.6.4 has now added support for the ruby coverage library as seen in this closed issue ( https://jira.codehaus.org/browse/JRUBY-5935 ). When I tried simplecov when running my rspecs, at the end of the run when it is calculating the coverage, I got the following error:
SystemStackError: stack level too deep
eval at org/jruby/RubyKernel.java:1093
result at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/1.9/erb.rb:753
formatted_file_list at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/simplecov-html.rb:53
result at (erb):30
eval at org/jruby/RubyKernel.java:1093
result at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/1.9/erb.rb:753
format at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/simplecov-html.rb:19
open at org/jruby/RubyIO.java:1111
format at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-html-0.5.3/lib/simplecov-html.rb:18
format! at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.3/lib/simplecov/result.rb:90
at_exit at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.3/lib/simplecov/configuration.rb:133
call at org/jruby/RubyProc.java:262
(root) at /home/ray/Perforce/ray_ray-desktop/ThirdParty/jruby/jruby-1.6.4/lib/ruby/gems/1.8/gems/simplecov-0.5.3/lib/simplecov/defaults.rb:42
I was able to solve this issue by removing the jruby_float_fix.rb file. After this I am able to run rspec with simplecov and get a coverage report generated. Only problem now is that the coverage report is reporting 100% coverage for everything, and I know that is not true, esp when I run only one of my spec files. I'll gladly work with you to get this working as this is high priority for us, and I cannot find any other coverage tool out there that works for jruby and 1.9. Also one more issues is that for any view that is rendered, I get this error, but only when I start simplecov:
.......
The text was updated successfully, but these errors were encountered: