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

login
register
mail settings
Submitter phabricator
Date Nov. 28, 2018, 5:54 p.m.
Message ID <5e9be1032e5f3bc1765af59b7da8c543@localhost.localdomain>
Download mbox | patch
Permalink /patch/36825/
State Not Applicable
Headers show

Comments

phabricator - Nov. 28, 2018, 5:54 p.m.
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




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

Patch

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