# HG changeset patch # User Augie Fackler # Date 1542208363 18000 # Node ID d9fc51f77cc558f4a687f51e5ebd7d424688f917 # Parent 6c01fad8de32c06f366e24a718715ea165a8c579 tests: sniff for libfuzzer actually being available in test-fuzz-targets.t When I upgraded the FreeBSD buildbot to 11.2 it seems we picked up clang6, but the default clang on FreeBSD doesn't include libfuzzer. I can't find a way to sniff for libfuzzer without running a compile, so here we are. Differential Revision: https://phab.mercurial-scm.org/D5270 diff -r 6c01fad8de32 -r d9fc51f77cc5 tests/test-fuzz-targets.t --- a/tests/test-fuzz-targets.t Wed Nov 14 10:11:37 2018 -0500 +++ b/tests/test-fuzz-targets.t Wed Nov 14 10:12:43 2018 -0500 @@ -11,10 +11,26 @@ > MAKE=make > fi + $ havefuzz() { + > cat > $TESTTMP/dummy.cc < #include + > #include + > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } + > int main(int argc, char **argv) { + > const char data[] = "asdf"; + > return LLVMFuzzerTestOneInput((const uint8_t *)data, 4); + > } + > EOF + > $CXX $TESTTMP/dummy.cc -o $TESTTMP/dummy \ + > -fsanitize=fuzzer-no-link,address || return 1 + > } + #if clang-libfuzzer + $ CXX=clang++ havefuzz || exit 80 $ $MAKE -s clean all #endif #if no-clang-libfuzzer clang-6.0 + $ CXX=clang++-6.0 havefuzz || exit 80 $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 #endif #if no-clang-libfuzzer no-clang-6.0