Enable fuzzing support on macOS by configuring the build system to use Homebrew LLVM toolchain and handle macOS-specific linking requirements. The `make check-fuzz` command was failing on macOS because: - System clang lacks fuzzer runtime library support - Linking issues with fuzzer targets - Test script attempts to execute debug symbol files This PR adds macOS-specific configuration to: - Use Homebrew LLVM toolchain for fuzzer support - Explicitly link fuzzer libraries - Exclude `.dSYM` directories from test discovery All 76 fuzzer targets now build and pass on macOS.
43 lines
959 B
Bash
Executable File
43 lines
959 B
Bash
Executable File
#!/bin/bash -eu
|
|
|
|
# Runs each fuzz target on its seed corpus and prints any failures.
|
|
FUZZ_DIR=$(dirname "$0")
|
|
readonly FUZZ_DIR
|
|
# On macOS, exclude debug symbol files from fuzzer target discovery
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
TARGETS=$(find "${FUZZ_DIR}" -type f -name "fuzz-*" ! -name "*.*" ! -path "*.dSYM/*")
|
|
else
|
|
TARGETS=$(find "${FUZZ_DIR}" -type f -name "fuzz-*" ! -name "*.*")
|
|
fi
|
|
readonly TARGETS
|
|
|
|
export UBSAN_OPTIONS="halt_on_error=1:print_stacktrace=1"
|
|
|
|
passes=0
|
|
fails=0
|
|
for t in ${TARGETS}; do
|
|
target_name=$(basename "${t}")
|
|
corpus_dir="${FUZZ_DIR}/corpora/${target_name}/"
|
|
cmd="${t} -runs=0 ${corpus_dir}"
|
|
|
|
echo -n "Checking ${target_name}... "
|
|
if output=$(${cmd} 2>&1); then
|
|
echo "PASS"
|
|
passes=$((passes + 1))
|
|
else
|
|
echo "FAIL"
|
|
echo
|
|
echo "Failing command: ${cmd}"
|
|
echo "Output:"
|
|
echo "${output}"
|
|
echo
|
|
fails=$((fails + 1))
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo "TOTAL PASSED: ${passes}"
|
|
echo "TOTAL FAILED: ${fails}"
|
|
|
|
exit ${fails}
|