Skip to content

Commit

Permalink
Merge branch 'jruby-updates'
Browse files Browse the repository at this point in the history
* jruby-updates:
  Tests: modernize JRuby runtime configuration
  Tests: JRuby now bundles its OpenSSL gem

This gets everything working on JRuby 9000.

References #57.
  • Loading branch information
chrisk committed Jun 27, 2017
2 parents 9fde35b + a659cd6 commit 694429b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
15 changes: 4 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,11 @@ Rake::TestTask.new(:test) do |test|
test.verbose = false
test.warning = true

# This quells a JRuby warning from SimpleCov: "tracing (e.g.
# set_trace_func) will not capture all events without --debug flag".
# This flag changes two internal options: it enables the runtime's
# "full-trace" mode, then sets its "compile mode" to OFF so that
# all code runs through the interpreter. (See test_helper.rb for
# the Java and Ruby code exposing these.)
#
# Note that --debug is unrelated to lots of similar-sounding flags
# common to many implementations (-d, -D, --debugger, etc.) and so we
# don't need to set any of those. For details, see JRuby's
# To measure code coverage under JRuby, we need to pass --debug (enabling the
# runtime's "full-trace" mode) and --dev (setting its "compile mode" to OFF so
# all code runs through the interpreter). For details, see JRuby's
# util/cli/ArgumentProcessor.java.
test.ruby_opts << "--debug" if RUBY_PLATFORM == "java"
test.ruby_opts << "--debug" << "--dev" if RUBY_PLATFORM == "java"
end
Rake::Task["test"].enhance ["test:preflight"]
Rake::Task["test"].clear_comments if Rake::Task["test"].respond_to?(:clear_comments)
Expand Down
4 changes: 0 additions & 4 deletions fakeweb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,4 @@ Gem::Specification.new do |s|
# Test::Unit is no longer distributed with Ruby as of 2.2.0
s.add_development_dependency "test-unit", ["~> 3.2.4"]
end

if RUBY_PLATFORM == "java"
s.add_development_dependency "jruby-openssl", ["~> 0.8"]
end
end
15 changes: 3 additions & 12 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,12 @@ def current_ruby_opts
ruby_opts = []
ruby_opts << "-w" if defined?($-w) && $-w

# When you start JRuby with --debug, it does this:
#
# # src/org/jruby/util/cli/ArgumentProcessor.java:371
# RubyInstanceConfig.FULL_TRACE_ENABLED = true;
# config.setCompileMode(RubyInstanceConfig.CompileMode.OFF);
#
# This checks the same settings from Rubyland. See our Rakefile for
# some background on --debug.
# TODO: is there a good way to retrieve the command-line options
# used to start JRuby? --debug doesn't seem to have an analogue of
# $-w, $-d, etc.
# Propagate JRuby options needed to measure code coverage. See JRuby's
# util/cli/ArgumentProcessor.java for details.
if RUBY_PLATFORM == "java" &&
JRuby.runtime.instance_config.class.FULL_TRACE_ENABLED &&
JRuby.runtime.instance_config.compile_mode.to_s == "OFF"
ruby_opts << "--debug"
ruby_opts << "--debug" << "--dev"
end

ruby_opts
Expand Down

0 comments on commit 694429b

Please sign in to comment.