tests/test-fuzz-targets.t
changeset 43815 19da643dc10c
parent 42948 39cab871e880
child 46257 b918494198f7
equal deleted inserted replaced
43814:e137338e926b 43815:19da643dc10c
     1 #require test-repo
     1 #require test-repo
     2 
     2 
     3   $ cd $TESTDIR/../contrib/fuzz
     3   $ cd $TESTDIR/../contrib/fuzz
       
     4   $ OUT=$TESTTMP ; export OUT
     4 
     5 
     5 which(1) could exit nonzero, but that's fine because we'll still end
     6 which(1) could exit nonzero, but that's fine because we'll still end
     6 up without a valid executable, so we don't need to check $? here.
     7 up without a valid executable, so we don't need to check $? here.
     7 
     8 
     8   $ if which gmake >/dev/null 2>&1; then
     9   $ if which gmake >/dev/null 2>&1; then
    25   >        -fsanitize=fuzzer-no-link,address || return 1
    26   >        -fsanitize=fuzzer-no-link,address || return 1
    26   > }
    27   > }
    27 
    28 
    28 #if clang-libfuzzer
    29 #if clang-libfuzzer
    29   $ CXX=clang++ havefuzz || exit 80
    30   $ CXX=clang++ havefuzz || exit 80
    30   $ $MAKE -s clean all
    31   $ $MAKE -s clean all PYTHON_CONFIG=`which python-config`
    31 #endif
    32 #endif
    32 #if no-clang-libfuzzer clang-6.0
    33 #if no-clang-libfuzzer clang-6.0
    33   $ CXX=clang++-6.0 havefuzz || exit 80
    34   $ CXX=clang++-6.0 havefuzz || exit 80
    34   $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0
    35   $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 PYTHON_CONFIG=`which python-config`
    35 #endif
    36 #endif
    36 #if no-clang-libfuzzer no-clang-6.0
    37 #if no-clang-libfuzzer no-clang-6.0
    37   $ exit 80
    38   $ exit 80
    38 #endif
    39 #endif
    39 
    40 
    40 Just run the fuzzers for five seconds each to verify it works at all.
    41   $ cd $TESTTMP
    41   $ ./bdiff -max_total_time 5
    42 
    42   $ ./mpatch -max_total_time 5
    43 Run each fuzzer using dummy.cc as a fake input, to make sure it runs
    43   $ ./xdiff -max_total_time 5
    44 at all. In the future we should instead unpack the corpus for each
       
    45 fuzzer and use that instead.
       
    46 
       
    47   $ for fuzzer in `ls *_fuzzer | sort` ; do
       
    48   >   echo run $fuzzer...
       
    49   >   ./$fuzzer dummy.cc > /dev/null 2>&1 
       
    50   > done
       
    51   run bdiff_fuzzer...
       
    52   run dirs_fuzzer...
       
    53   run dirstate_fuzzer...
       
    54   run fm1readmarkers_fuzzer...
       
    55   run fncache_fuzzer...
       
    56   run jsonescapeu8fast_fuzzer...
       
    57   run manifest_fuzzer...
       
    58   run mpatch_fuzzer...
       
    59   run revlog_fuzzer...
       
    60   run xdiff_fuzzer...
    44 
    61 
    45 Clean up.
    62 Clean up.
       
    63   $ cd $TESTDIR/../contrib/fuzz
    46   $ $MAKE -s clean
    64   $ $MAKE -s clean