diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2017-08-21 15:16:55 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-08-24 16:39:21 +0200 |
commit | 2ccf497e918cf1d78e8cd650e4554b5551c902e2 (patch) | |
tree | 06f1baed9f536400a51c66f67d9afa2222b2e842 /fuzz | |
parent | efdede1b1dcc6d82fe68e0ee2fc0ab8b87e29537 (diff) | |
download | gnutls-2ccf497e918cf1d78e8cd650e4554b5551c902e2.tar.gz |
fuzzer: Add script 'view-coverage'
This helper script is for viewing the code coverage of
single (or combined) fuzzers running with all his corpora.
It helps optimizing the code coverage by hand-crafting corpora
and/or dictionaries.
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'fuzz')
-rwxr-xr-x | fuzz/view-coverage.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fuzz/view-coverage.sh b/fuzz/view-coverage.sh new file mode 100755 index 0000000000..9461ba6468 --- /dev/null +++ b/fuzz/view-coverage.sh @@ -0,0 +1,28 @@ +#!/bin/bash -eu +# +# (C)2017 Tim Ruehsen tim.ruehsen@gmx.de +# +# View the coverage report for one or more fuzzers. + +# 1. execute 'make coverage' in the fuzz/ directory +# 2. execute './view-coverage.sh <fuzz target(s)> + +# Example with single fuzzer: +# ./view-coverage.sh gnutls_client_fuzzer + +# Example with two fuzzers: +# ./view-coverage.sh gnutls_base64_decoder_fuzzer gnutls_base64_encoder_fuzzer + +if test -z "$1"; then + echo "Usage: $0 <fuzz target(s)>" + echo "Example: $0 gnutls_client_fuzzer" + exit 1 +fi + +LCOV_INFO=coverage.info +lcov --zerocounters --directory ../lib/ +lcov --capture --initial --directory ../lib/.libs --directory . --output-file $LCOV_INFO +make check TESTS="$*" CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" +lcov --capture --directory ../lib/.libs --output-file $LCOV_INFO +genhtml --prefix . --ignore-errors source $LCOV_INFO --legend --title "$*" --output-directory=lcov +xdg-open lcov/index.html |