Skip to content

build: make clean removes .gcda and .gcno files from fuzz directory - #19672

Merged
maflcko merged 1 commit into
bitcoin:masterfrom
Crypt-iQ:fuzz_cov_cleanup_0806
Aug 8, 2020
Merged

maflcko merged 1 commit into
bitcoin:masterfrom
Crypt-iQ:fuzz_cov_cleanup_0806

Conversation

@Crypt-iQ

@Crypt-iQ Crypt-iQ commented Aug 6, 2020

Copy link
Copy Markdown
Contributor

I believe these should also be deleted upon invoking make clean. It also garbles the coverage file if you try to fuzz the same harness again.

With this commit, make clean now removes coverage files from the
fuzzing directory. Without this, subsequent fuzzing runs would have
garbled coverage signals for files in the fuzz directory as
they were never deleted with make clean.
@practicalswift

Copy link
Copy Markdown
Contributor

ACK 90bd476 -- patch looks correct

Thanks for your continued work on improving (and reviewing) src/test/fuzz/ :)

@hebasto

hebasto commented Aug 7, 2020 •

Copy link
Copy Markdown
Member

I'm a bit confused.

I run

./configure --with-incompatible-bdb --enable-lcov --enable-fuzz CC=clang CXX=clang++ && make

and a bunch of *.gcno files were generated in the src/test/fuzz directory.

The following run

make check

fails for me (because configure: WARNING: enable-fuzz will disable all other targets), and no *.gcda files wer generated in the src/test/fuzz directory.

Does this mean that we should just prevent combining --enable-lcov with --enable-fuzz?

@Crypt-iQ

Crypt-iQ commented Aug 7, 2020

Copy link
Copy Markdown
Contributor Author

What is the output of make check? *.gcda files should only appear if you run one of the fuzz tests and make check doesn't run the binaries.

@hebasto hebasto left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 90bd476, tested on Linux Mint 20 (x86_64).

@hebasto

hebasto commented Aug 7, 2020

Copy link
Copy Markdown
Member

Revoke my ACK.

Still having concerns about usefulness of combining --enable-lcov with --enable-fuzz:

$ ./autogen.sh
$ ./configure --enable-lcov --enable-fuzz --with-sanitizers=address,fuzzer,undefined CC=clang CXX=clang++
$ make
$ make cov
/usr/bin/lcov --gcov-tool=/usr/bin/gcov -c -i -d /home/hebasto/guix/GitHub/bitcoin/src -o baseline.info
Capturing coverage data from /home/hebasto/guix/GitHub/bitcoin/src
Found gcov version: 9.3.0
Using intermediate gcov format
Scanning /home/hebasto/guix/GitHub/bitcoin/src for .gcno files ...
Found 338 graph files in /home/hebasto/guix/GitHub/bitcoin/src
Processing src/libbitcoin_consensus_a-pubkey.gcno
/home/hebasto/guix/GitHub/bitcoin/src/libbitcoin_consensus_a-pubkey.gcno:version '402*', prefer 'A93*'
geninfo: ERROR: GCOV failed for /home/hebasto/guix/GitHub/bitcoin/src/libbitcoin_consensus_a-pubkey.gcno!
make: *** [Makefile:1318: baseline.info] Error 255
rm baseline.info

@Crypt-iQ

Crypt-iQ commented Aug 7, 2020

Copy link
Copy Markdown
Contributor Author

I've only ever gotten --enable-lcov --enable-fuzz to work with afl-gcc & afl-g++. See this issue #12602 It would be very helpful if I could get it to work with clang but I haven't had the time yet.

@hebasto hebasto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 90bd476, tested with hints from #12602 and #18107.

@darosior darosior left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 90bd476

@maflcko
maflcko merged commit e349eee into bitcoin:master Aug 8, 2020
@Crypt-iQ
Crypt-iQ deleted the fuzz_cov_cleanup_0806 branch August 9, 2020 14:46
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 19, 2021
…from fuzz directory

90bd476 build: make clean removes .gcda and .gcno files from fuzz directory (eugene)

Pull request description:

  I believe these should also be deleted upon invoking `make clean`. It also garbles the coverage file if you try to fuzz the same harness again.

ACKs for top commit:
  practicalswift:
    ACK 90bd476 -- patch looks correct
  hebasto:
    ACK 90bd476, tested with hints from bitcoin#12602 and bitcoin#18107.
  darosior:
    ACK 90bd476

Tree-SHA512: 4b2eb664f64d18bc0385c5a0040b0b9fa6fe470c941ae39c7cb4544c4283427a8d4985517475fe0295c3ab2794b9a2ad4f76b6a443c05d846c97c966add87ca9
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants