tests/test-fuzz-targets.t
author Augie Fackler <augie@google.com>
Wed, 14 Nov 2018 10:11:37 -0500
branchstable
changeset 40726 6c01fad8de32
parent 38246 46dcb9f14900
child 40727 d9fc51f77cc5
permissions -rw-r--r--
tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t This isn't as robust as it probably should be, but for now it'll get the job done on the buildbots. Differential Revision: https://phab.mercurial-scm.org/D5269
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38236
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
     1
#require test-repo
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
     2
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
  $ cd $TESTDIR/../contrib/fuzz
38236
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
     4
40726
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
     5
which(1) could exit nonzero, but that's fine because we'll still end
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
     6
up without a valid executable, so we don't need to check $? here.
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
     7
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
     8
  $ if which gmake >/dev/null 2>&1; then
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
     9
  >     MAKE=gmake
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    10
  > else
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    11
  >     MAKE=make
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    12
  > fi
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    13
38236
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    14
#if clang-libfuzzer
40726
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    15
  $ $MAKE -s clean all
38236
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    16
#endif
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    17
#if no-clang-libfuzzer clang-6.0
40726
6c01fad8de32 tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    18
  $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0
38236
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    19
#endif
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    20
#if no-clang-libfuzzer no-clang-6.0
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    21
  $ exit 80
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    22
#endif
a6347ae6168d test-fuzz-targets: look for clang-6.0 binary as well
Yuya Nishihara <yuya@tcha.org>
parents: 38235
diff changeset
    23
38172
24cc2969abae tests: update fuzzer tests to include both fuzzers
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    24
Just run the fuzzers for five seconds each to verify it works at all.
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
  $ ./bdiff -max_total_time 5
38246
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38236
diff changeset
    26
  $ ./mpatch -max_total_time 5
38172
24cc2969abae tests: update fuzzer tests to include both fuzzers
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    27
  $ ./xdiff -max_total_time 5