Skip to content
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

Fix #14, support for Ruby back to 3.0.0 #15

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Ruzzy.c_trace_branch` to `Ruzzy.trace` to simplify interface
- Support for `clang` back to `14.0.6`, and system `clang`, e.g. from `apt` ([#12](https://github.com/trailofbits/ruzzy/pull/12))

### Fixed

- Support for Ruby back to `3.0.0` (Ubuntu 22.04) ([#14](https://github.com/trailofbits/ruzzy/issues/14))

## [0.6.0] - 2024-02-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Table of contents:

# Installing

Currently, Ruzzy only supports Linux x86-64 and AArch64/ARM64. If you'd like to run Ruzzy on a Mac or Windows, you can build the [`Dockerfile`](https://github.com/trailofbits/ruzzy/blob/main/Dockerfile) and/or use the [development environment](#developing). Ruzzy requires a recent version of `clang` (tested back to `14.0.6`), preferably the [latest release](https://github.com/llvm/llvm-project/releases).
Currently, Ruzzy only supports Linux x86-64 and AArch64/ARM64. If you'd like to run Ruzzy on a Mac or Windows, you can build the [`Dockerfile`](https://github.com/trailofbits/ruzzy/blob/main/Dockerfile) and/or use the [development environment](#developing). Ruzzy requires a recent version of `clang` (tested back to `14.0.0`), preferably the [latest release](https://github.com/llvm/llvm-project/releases).

Install Ruzzy with the following command:

Expand Down
6 changes: 3 additions & 3 deletions ext/cruzzy/cruzzy.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ static void event_hook_branch(VALUE counter_hash, rb_trace_arg_t *tracearg) {

static void enable_branch_coverage_hooks()
{
// Call Coverage.setup(branches: true) to activate branch coverage hooks.
// Call Coverage.start(branches: true) to activate branch coverage hooks.
// Branch coverage hooks will not be activated without this call despite
// adding the event hooks. I suspect rb_set_coverages must be called
// first, which initializes some global state that we do not have direct
// access to. Calling setup initializes coverage state here:
// access to. Calling start initializes coverage state here:
// https://github.com/ruby/ruby/blob/v3_3_0/ext/coverage/coverage.c#L112-L120
// If rb_set_coverages is not called, then rb_get_coverages returns a NULL
// pointer, which appears to effectively disable coverage collection here:
Expand All @@ -207,7 +207,7 @@ static void enable_branch_coverage_hooks()
VALUE coverage_mod = rb_const_get(rb_cObject, rb_intern("Coverage"));
VALUE hash_arg = rb_hash_new();
rb_hash_aset(hash_arg, ID2SYM(rb_intern("branches")), Qtrue);
rb_funcall(coverage_mod, rb_intern("setup"), 1, hash_arg);
rb_funcall(coverage_mod, rb_intern("start"), 1, hash_arg);
}

static VALUE c_trace(VALUE self, VALUE harness_path)
Expand Down