Skip to content

Conversation

@AdamKorcz
Copy link
Collaborator

This enables coverage reports for Ruby projects.

The following was required:

  1. Both base-builder-ruby and base-runner need the SimpleCov dependency which is a library for generating coverage reports for Ruby projects.
  2. SimpleCov creates a coverage report that consists of several files. I have added scripts that merge that coverage report into a single html file. These scripts are infra/base-images/base-runner/consolidate_ruby_coverage.sh and infra/base-images/base-runner/consolidate_html.py.
  3. I have added a higher-level Ruby module that users should invoke instead of Ruzzy.fuzz(). There are two reasons for this: 1) I could't get coverage to work by calling Ruzzy.fuzz() - it doesn't work well with SimpleCov, and 2) Ruzzy.fuzz() was preventing SimpleCov from working properly. The difference is very small: Instead of users calling Ruzzy.fuzz(), they now do require 'ossfuzz_helper' and then run OSSFuzz.fuzz(). The ox-ruby fuzzers demonstrate this.

To test this:

cd /tmp
git clone https://github.com/AdamKorcz/oss-fuzz --branch=ruby-coverage-report
cd ruby-coverage-report
# rebuild base images (./infra/base-images/all.sh)
mkdir -p build/corpus/ox-ruby/fuzz_parse
python3 ./infra/helper.py build_fuzzers ox-ruby
python3 ./infra/helper.py run_fuzzer ox-ruby fuzz_parse --corpus-dir=$PWD/build/corpus/ox-ruby/fuzz_parse
# kill it after a few seconds
python3 ./infra/helper.py build_fuzzers ox-ruby --sanitizer=coverage
python3 ./infra/helper.py coverage ox-ruby --no-corpus-download

Signed-off-by: Adam Korczynski <[email protected]>
Signed-off-by: Adam Korczynski <[email protected]>
@AdamKorcz
Copy link
Collaborator Author

/gcbrun trial_build.py all

@AdamKorcz
Copy link
Collaborator Author

AdamKorcz commented Nov 26, 2025

None of the failures in the trial_build are caused by this PR:

Project Failed builds Already fails
typst coverage
uint256 coverage
unirest-java coverage
unrar coverage
wamr coverage
yajl-ruby coverage
ygot coverage
upx fuzzing
urllib3 fuzzing
wheel fuzzing
yoga fuzzing
vitess fuzzing + coverage
wasmer fuzzing + coverage
xmlbeans fuzzing + coverage
xmlsec fuzzing + coverage
xnnpack fuzzing + coverage
xpdf fuzzing + coverage
xstream fuzzing + coverage
unicorn introspector
uwebsockets introspector
wabt introspector
wazuh introspector
wireshark introspector ❌ (times out)
wget2 introspector
wxwidgets introspector
xerces-c introspector
wolfssl introspector
xnu introspector
wget fuzzing + coverage + introspector
wolfmqtt fuzzing + coverage + introspector
xvid fuzzing + coverage + introspector
zeek fuzzing + coverage + introspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants