fuzz: link fuzz programs with `make all` on Linuxjs/build-fuzz-more-often
commit8427b7e72be088a4ebe12d2603c43c73657377bb
authorJosh Steadmon <steadmon@google.com>
Wed, 24 Apr 2024 18:14:42 +0000 (24 11:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Apr 2024 18:56:40 +0000 (24 11:56 -0700)
tree6bfe944f263c972ccd4dc5f7e2240e752f9f9b4c
parent436d4e5b14df49870a897f64fe92c0ddc7017e4c
fuzz: link fuzz programs with `make all` on Linux

Since 5e47215080 (fuzz: add basic fuzz testing target., 2018-10-12), we
have compiled object files for the fuzz tests as part of the default
'make all' target. This helps prevent bit-rot in lesser-used parts of
the codebase, by making sure that incompatible changes are caught at
build time.

However, since we never linked the fuzzer executables, this did not
protect us from link-time errors. As of 8b9a42bf48 (fuzz: fix fuzz test
build rules, 2024-01-19), it's now possible to link the fuzzer
executables without using a fuzzing engine and a variety of
compiler-specific (and compiler-version-specific) flags, at least on
Linux. So let's add a platform-specific option in config.mak.uname to
link the executables as part of the default `make all` target.

Since linking the fuzzer executables without a fuzzing engine does not
require a C++ compiler, we can change the FUZZ_PROGRAMS build rule to
use $(CC) by default. This avoids compiler mis-match issues when
overriding $(CC) but not $(CXX). When we *do* want to actually link with
a fuzzing engine, we can set $(FUZZ_CXX). The build instructions in the
CI fuzz-smoke-test job and in the Makefile comment have been updated
accordingly.

While we're at it, we can consolidate some of the fuzzer build
instructions into one location in the Makefile.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
ci/run-build-and-minimal-fuzzers.sh
config.mak.uname