##// END OF EJS Templates
tests: clean up built binaries after running test-fuzz-targets.t...
Augie Fackler -
r43218:39cab871 default
parent child Browse files
Show More
@@ -1,43 +1,46
1 #require test-repo
1 #require test-repo
2
2
3 $ cd $TESTDIR/../contrib/fuzz
3 $ cd $TESTDIR/../contrib/fuzz
4
4
5 which(1) could exit nonzero, but that's fine because we'll still end
5 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.
6 up without a valid executable, so we don't need to check $? here.
7
7
8 $ if which gmake >/dev/null 2>&1; then
8 $ if which gmake >/dev/null 2>&1; then
9 > MAKE=gmake
9 > MAKE=gmake
10 > else
10 > else
11 > MAKE=make
11 > MAKE=make
12 > fi
12 > fi
13
13
14 $ havefuzz() {
14 $ havefuzz() {
15 > cat > $TESTTMP/dummy.cc <<EOF
15 > cat > $TESTTMP/dummy.cc <<EOF
16 > #include <stdlib.h>
16 > #include <stdlib.h>
17 > #include <stdint.h>
17 > #include <stdint.h>
18 > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
18 > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
19 > int main(int argc, char **argv) {
19 > int main(int argc, char **argv) {
20 > const char data[] = "asdf";
20 > const char data[] = "asdf";
21 > return LLVMFuzzerTestOneInput((const uint8_t *)data, 4);
21 > return LLVMFuzzerTestOneInput((const uint8_t *)data, 4);
22 > }
22 > }
23 > EOF
23 > EOF
24 > $CXX $TESTTMP/dummy.cc -o $TESTTMP/dummy \
24 > $CXX $TESTTMP/dummy.cc -o $TESTTMP/dummy \
25 > -fsanitize=fuzzer-no-link,address || return 1
25 > -fsanitize=fuzzer-no-link,address || return 1
26 > }
26 > }
27
27
28 #if clang-libfuzzer
28 #if clang-libfuzzer
29 $ CXX=clang++ havefuzz || exit 80
29 $ CXX=clang++ havefuzz || exit 80
30 $ $MAKE -s clean all
30 $ $MAKE -s clean all
31 #endif
31 #endif
32 #if no-clang-libfuzzer clang-6.0
32 #if no-clang-libfuzzer clang-6.0
33 $ CXX=clang++-6.0 havefuzz || exit 80
33 $ CXX=clang++-6.0 havefuzz || exit 80
34 $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0
34 $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0
35 #endif
35 #endif
36 #if no-clang-libfuzzer no-clang-6.0
36 #if no-clang-libfuzzer no-clang-6.0
37 $ exit 80
37 $ exit 80
38 #endif
38 #endif
39
39
40 Just run the fuzzers for five seconds each to verify it works at all.
40 Just run the fuzzers for five seconds each to verify it works at all.
41 $ ./bdiff -max_total_time 5
41 $ ./bdiff -max_total_time 5
42 $ ./mpatch -max_total_time 5
42 $ ./mpatch -max_total_time 5
43 $ ./xdiff -max_total_time 5
43 $ ./xdiff -max_total_time 5
44
45 Clean up.
46 $ $MAKE -s clean
General Comments 0
You need to be logged in to leave comments. Login now