D5270: tests: sniff for libfuzzer actually being available in test-fuzz-targets.t

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Nov 14 15:13:15 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5270

AFFECTED FILES
  tests/test-fuzz-targets.t

CHANGE DETAILS

diff --git a/tests/test-fuzz-targets.t b/tests/test-fuzz-targets.t
--- a/tests/test-fuzz-targets.t
+++ b/tests/test-fuzz-targets.t
@@ -8,10 +8,24 @@
   >     MAKE=make
   > fi
 
+  $ havefuzz() {
+  >     cat > dummy.cc <<EOF
+  > 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
+  >     cat dummy.cc
+  >     $CXX dummy.cc -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



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list