Skip to content

Commit

Permalink
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -217,7 +217,8 @@ public class Options {
public static final Option<Boolean> CLI_STRIP_HEADER = bool(CLI, "cli.strip.header", false, "Strip text before shebang in script. Same as -x.");
public static final Option<Boolean> CLI_LOAD_GEMFILE = bool(CLI, "cli.load.gemfile", false, "Load a bundler Gemfile in cwd before running. Same as -G.");

public static final Option<Boolean> TRUFFLE_COVERAGE = bool(TRUFFLE, "truffle.coverage", false, "Enable coverage (will be enabled by default in the future - currently has some bugs");
public static final Option<Boolean> TRUFFLE_COVERAGE = bool(TRUFFLE, "truffle.coverage", false, "Enable coverage (will be enabled by default in the future - currently has some bugs).");
public static final Option<Boolean> TRUFFLE_COVERAGE_GLOBAL = bool(TRUFFLE, "truffle.coverage.global", false, "Run coverage for all code and print results on exit.");

public static final Option<String> TRUFFLE_CORE_LOAD_PATH = string(TRUFFLE, "truffle.core.load_path", "truffle:/jruby-truffle", "Location to load the Truffle core library from.");

Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ public class Options {
// Features

public final boolean COVERAGE = org.jruby.util.cli.Options.TRUFFLE_COVERAGE.load();
public final boolean COVERAGE_GLOBAL = org.jruby.util.cli.Options.TRUFFLE_COVERAGE_GLOBAL.load();

// Resources

Original file line number Diff line number Diff line change
@@ -148,8 +148,12 @@ public RubyContext(Ruby runtime, TruffleLanguage.Env env) {

// TODO(CS, 28-Jan-15) this is global
// TODO(CS, 28-Jan-15) maybe not do this for core?
if (options.COVERAGE) {
if (options.COVERAGE || options.COVERAGE_GLOBAL) {
coverageTracker = new CoverageTracker();

if (options.COVERAGE_GLOBAL) {
env.instrumenter().install(coverageTracker);
}
} else {
coverageTracker = null;
}
@@ -665,6 +669,10 @@ public void shutdown() {
}

threadManager.shutdown();

if (options.COVERAGE_GLOBAL) {
coverageTracker.print(System.out);
}
}

public PrintStream getDebugStandardOut() {

0 comments on commit 9579fbe

Please sign in to comment.