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

login
register
mail settings
Submitter phabricator
Date Nov. 27, 2018, 4:13 p.m.
Message ID <fed010bee69733f5f3b27cb11bfc58a4@localhost.localdomain>
Download mbox | patch
Permalink /patch/36820/
State Not Applicable
Headers show

Comments

phabricator - Nov. 27, 2018, 4:13 p.m.
durin42 updated this revision to Diff 12613.

REPOSITORY
  rHG Mercurial

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

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
Yuya Nishihara - Nov. 28, 2018, 11:29 a.m.
> +  $ havefuzz() {
> +  >     cat > $TESTTMP/dummy.cc <<EOF
> +  > #include <stdlib.h>
> +  > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }

Still stdint.h is missing.
phabricator - Nov. 28, 2018, 11:30 a.m.
yuja added a comment.


  > +  $ havefuzz() {
  >  +  >     cat > $TESTTMP/dummy.cc <<EOF
  >  +  > #include <stdlib.h>
  >  +  > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
  
  Still stdint.h is missing.

REPOSITORY
  rHG Mercurial

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

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