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

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Nov 28 12:54:46 EST 2018


durin42 updated this revision to Diff 12616.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5270?vs=12613&id=12616

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
@@ -12,10 +12,26 @@
   >     MAKE=make
   > fi
 
+  $ havefuzz() {
+  >     cat > $TESTTMP/dummy.cc <<EOF
+  > #include <stdlib.h>
+  > #include <stdint.h>
+  > 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



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


More information about the Mercurial-devel mailing list