From 2ccf497e918cf1d78e8cd650e4554b5551c902e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Mon, 21 Aug 2017 15:16:55 +0200 Subject: fuzzer: Add script 'view-coverage' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- fuzz/view-coverage.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 fuzz/view-coverage.sh 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 + +# 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 " + 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 -- cgit v1.2.1