##// END OF EJS Templates
tests: finally fix up test-fuzz-targets.t...
tests: finally fix up test-fuzz-targets.t It's been failing on my workstation for a while, since I have a new enough LLVM that I had the fuzzer goo, but not so new that I actually had FuzzedDataProvider. This is a better solution all around in my opinion. I _believe_ this should let us run these tests on most systems, even those using GCC instead of clang. That said, my one attempt to test this on my macOS laptop failed miserably, and I don't feel like doing more work on this right now. Differential Revision: https://phab.mercurial-scm.org/D7566

File last commit:

r44254:ece90792 default
r44267:19da643d default
Show More
test-fuzz-targets.t
64 lines | 1.7 KiB | text/troff | Tads3Lexer
/ tests / test-fuzz-targets.t
Yuya Nishihara
test-fuzz-targets: look for clang-6.0 binary as well...
r38238 #require test-repo
Augie Fackler
contrib: add some basic scaffolding for some fuzz test targets...
r35688 $ cd $TESTDIR/../contrib/fuzz
Augie Fackler
tests: finally fix up test-fuzz-targets.t...
r44267 $ OUT=$TESTTMP ; export OUT
Yuya Nishihara
test-fuzz-targets: look for clang-6.0 binary as well...
r38238
Augie Fackler
tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t...
r40799 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.
$ if which gmake >/dev/null 2>&1; then
> MAKE=gmake
> else
> MAKE=make
> fi
Augie Fackler
tests: sniff for libfuzzer actually being available in test-fuzz-targets.t...
r40800 $ 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
> }
Yuya Nishihara
test-fuzz-targets: look for clang-6.0 binary as well...
r38238 #if clang-libfuzzer
Augie Fackler
tests: sniff for libfuzzer actually being available in test-fuzz-targets.t...
r40800 $ CXX=clang++ havefuzz || exit 80
Augie Fackler
tests: finally fix up test-fuzz-targets.t...
r44267 $ $MAKE -s clean all PYTHON_CONFIG=`which python-config`
Yuya Nishihara
test-fuzz-targets: look for clang-6.0 binary as well...
r38238 #endif
#if no-clang-libfuzzer clang-6.0
Augie Fackler
tests: sniff for libfuzzer actually being available in test-fuzz-targets.t...
r40800 $ CXX=clang++-6.0 havefuzz || exit 80
Augie Fackler
tests: finally fix up test-fuzz-targets.t...
r44267 $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0 PYTHON_CONFIG=`which python-config`
Yuya Nishihara
test-fuzz-targets: look for clang-6.0 binary as well...
r38238 #endif
#if no-clang-libfuzzer no-clang-6.0
$ exit 80
#endif
Augie Fackler
tests: finally fix up test-fuzz-targets.t...
r44267 $ 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...
Augie Fackler
tests: clean up built binaries after running test-fuzz-targets.t...
r43218
Clean up.
Augie Fackler
tests: finally fix up test-fuzz-targets.t...
r44267 $ cd $TESTDIR/../contrib/fuzz
Augie Fackler
tests: clean up built binaries after running test-fuzz-targets.t...
r43218 $ $MAKE -s clean