Skip to content

Commit

Permalink
Improve test cases and fuzz to improve code coverage (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
joii2020 authored Aug 17, 2023
1 parent a58b9c0 commit 8e11ef1
Show file tree
Hide file tree
Showing 10 changed files with 1,208 additions and 282 deletions.
22 changes: 12 additions & 10 deletions examples/lazy-reader-tests/fuzz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

# To accelerate the fuzzing process, please download the pre-made corpus file
# from the following link:
# https://gist.github.com/XuJiandong/852905df792d34a3400b98145b0f69e7 Save the
# https://gist.github.com/joii2020/ce55af204f946eebd83269ef8da3f3d1 Save the
# file named corpus.bin to the corpus/fuzz_target_1/ folder.

all:
cargo fuzz run -j40 fuzz_target_1
cargo fuzz run -j30 fuzz_target_1

DEFAUTL_TARGET = `rustup show | grep 'Default host' | grep -o ': .*' | sed 's/: //'`
cov:
cargo fuzz coverage fuzz_target_1

show:
~/.rustup/toolchains/nightly-2023-07-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov \
show target/x86_64-unknown-linux-gnu/release/fuzz_target_1 \
--format=html \
--instr-profile=coverage/fuzz_target_1/coverage.profdata \
> coverage.html
cargo fuzz coverage fuzz_target_1
cargo-cov -- \
show target/$(DEFAUTL_TARGET)/coverage/$(DEFAUTL_TARGET)/release/fuzz_target_1 \
--format=html \
--ignore-filename-regex="(\/.*\/registry\/*)|(\/rustc\/*)|(\/types_api.rs)" \
-instr-profile=coverage/fuzz_target_1/coverage.profdata \
> coverage.html

install:
rustup component add llvm-tools-preview
cargo install cargo-fuzz
cargo install cargo-binutils

.PHONY:
all cov install
Expand Down
Loading

0 comments on commit 8e11ef1

Please sign in to comment.