Skip to content

Commit

Permalink
Turn off Coverage tests under JRuby.
Browse files Browse the repository at this point in the history
 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)'
  • Loading branch information
bf4 committed May 4, 2014
1 parent 6d605ff commit 7fd31ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ gemfile:
before_install:
- gem install bundler
- bundle config --local without local_development yard guard
# env:
# - "rack=1.3.4"
rvm:
# 2.1, not 2.1.0 until fixed https://github.com/travis-ci/travis-ci/issues/2220
- 2.1
- 2.0.0
- 1.9.3
- 1.9.2
- jruby
- rbx-2
matrix:
include:
- rvm: jruby
env: JRUBY_OPTS="--debug"
allow_failures:
- rvm: rbx-2
- rvm: 2.1
fast_finish: true
9 changes: 9 additions & 0 deletions lib/metric_fu/metrics/rcov/simplecov_formatter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
if defined?(JRUBY_VERSION)
if ENV["JRUBY_OPTS"].to_s !~ /-Xcli.debug=true/
warn "Coverage may be inaccurate; Try setting JRUBY_OPTS=\"-Xcli.debug=true --debug\""
# see https://github.com/metricfu/metric_fu/pull/226
# https://github.com/jruby/jruby/issues/1196
# https://jira.codehaus.org/browse/JRUBY-6106
# https://github.com/colszowka/simplecov/issues/86
end
end
require 'simplecov'
require_relative 'external_client'
require_relative 'rcov_format_coverage'
Expand Down
4 changes: 4 additions & 0 deletions spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
expect(content).to match(/!! value \* value/)
end

if defined?(JRUBY_VERSION)
STDOUT.puts "Skipping spec 'cause JRuby doesn't do Coverage right"
else
it 'calculates the same coverage from an RCov report as from SimpleCov' do
SimpleCov.start # start coverage
require 'fixtures/coverage-153'
Expand All @@ -60,6 +63,7 @@
expect(line.coverage).to eq(line_coverage_from_rcov_text[index])
end
end
end

end
end

0 comments on commit 7fd31ea

Please sign in to comment.