Patchwork D7566: tests: finally fix up test-fuzz-targets.t

login
register
mail settings
Submitter phabricator
Date Dec. 7, 2019, 4:04 a.m.
Message ID <198fb136fc41eed5080bf3a7488b95da@localhost.localdomain>
Download mbox | patch
Permalink /patch/43626/
State Not Applicable
Headers show

Comments

phabricator - Dec. 7, 2019, 4:04 a.m.
Closed by commit rHGece907920139: tests: finally fix up test-fuzz-targets.t (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7566?vs=18504&id=18517

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7566/new/

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

AFFECTED FILES
  contrib/fuzz/Makefile
  tests/test-fuzz-targets.t

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mjpieters, 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
@@ -1,6 +1,7 @@ 
 #require test-repo
 
   $ cd $TESTDIR/../contrib/fuzz
+  $ OUT=$TESTTMP ; export OUT
 
 which(1) could exit nonzero, but that's fine because we'll still end
 up without a valid executable, so we don't need to check $? here.
@@ -27,20 +28,37 @@ 
 
 #if clang-libfuzzer
   $ CXX=clang++ havefuzz || exit 80
-  $ $MAKE -s clean all
+  $ $MAKE -s clean all PYTHON_CONFIG=`which python-config`
 #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
+  $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 PYTHON_CONFIG=`which python-config`
 #endif
 #if no-clang-libfuzzer no-clang-6.0
   $ exit 80
 #endif
 
-Just run the fuzzers for five seconds each to verify it works at all.
-  $ ./bdiff -max_total_time 5
-  $ ./mpatch -max_total_time 5
-  $ ./xdiff -max_total_time 5
+  $ cd $TESTTMP
+
+Run each fuzzer using dummy.cc as a fake input, to make sure it runs
+at all. In the future we should instead unpack the corpus for each
+fuzzer and use that instead.
+
+  $ for fuzzer in `ls *_fuzzer | sort` ; do
+  >   echo run $fuzzer...
+  >   ./$fuzzer dummy.cc > /dev/null 2>&1 
+  > done
+  run bdiff_fuzzer...
+  run dirs_fuzzer...
+  run dirstate_fuzzer...
+  run fm1readmarkers_fuzzer...
+  run fncache_fuzzer...
+  run jsonescapeu8fast_fuzzer...
+  run manifest_fuzzer...
+  run mpatch_fuzzer...
+  run revlog_fuzzer...
+  run xdiff_fuzzer...
 
 Clean up.
+  $ cd $TESTDIR/../contrib/fuzz
   $ $MAKE -s clean
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -14,7 +14,7 @@ 
 
 CXXFLAGS += -Wno-deprecated-register
 
-all: bdiff mpatch xdiff
+all: standalone_fuzz_target_runner.o oss-fuzz
 
 standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cc