File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ set -x
4+
5+ # Check if we're in the root directory, if so change to fuzz
6+ if [ -d " fuzz" ]; then
7+ cd fuzz
8+ elif [ ! -f " Cargo.toml" ] || ! grep -q " fuzz" Cargo.toml 2> /dev/null; then
9+ echo " Error: Please run this script from the rust-lightning root directory or fuzz directory"
10+ exit 1
11+ fi
12+
13+ # Check if test_cases directory exists and has content
14+ show_corpus_message=false
15+ if [ ! -d " test_cases" ]; then
16+ show_corpus_message=true
17+ elif [ -z " $( find test_cases -name ' *' -type f 2> /dev/null | head -1) " ]; then
18+ show_corpus_message=true
19+ fi
20+
21+ if [ " $show_corpus_message " = true ]; then
22+ echo " Warning: No corpus found in test_cases directory."
23+ echo " Generating coverage report without fuzzing corpus."
24+ echo " "
25+ echo " To include fuzzing corpus coverage, create test_cases directories with your corpus:"
26+ echo " mkdir -p test_cases/{target_name}"
27+ echo " cp your_corpus_directory/* test_cases/{target_name}/"
28+ echo " "
29+ echo " Example:"
30+ echo " mkdir -p test_cases/base32"
31+ echo " cp /path/to/your/base32_corpus/* test_cases/base32/"
32+ echo " "
33+ fi
34+
35+ export RUSTFLAGS=" --cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz"
36+ # ignore anything in fuzz directory since we don't want coverage of targets
37+ cargo llvm-cov --html --ignore-filename-regex " fuzz/"
38+
39+ echo " "
40+ echo " Coverage report generated in target/llvm-cov/html/index.html"
41+
42+
You can’t perform that action at this time.
0 commit comments