forked from rust-fuzz/targets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·47 lines (36 loc) · 907 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh -ve
sh -ve gen-targets-src.sh
cargo install afl honggfuzz --force --verbose
# AFL
cd fuzzer-afl
cargo update
cargo afl build --verbose
cd ..
# Honggfuzz
cd fuzzer-honggfuzz
cargo update
cargo hfuzz build-debug --verbose
cd ..
# LibFuzzer
cd fuzzer-libfuzzer
export RUSTFLAGS="$RUSTFLAGS \
--cfg fuzzing \
-C passes=sancov \
-C llvm-args=-sanitizer-coverage-level=4 \
-C llvm-args=-sanitizer-coverage-trace-pc-guard \
-C llvm-args=-sanitizer-coverage-prune-blocks=0 \
-C debug-assertions=on \
-C debuginfo=0 \
-C opt-level=3 "
if [ "`uname`" = "Darwin" ] ; then
TARGET="x86_64-apple-darwin"
elif [ "`uname`" = "Linux" ] ; then
TARGET="x86_64-unknown-linux-gnu"
export RUSTFLAGS="$RUSTFLAGS -C llvm-args=-sanitizer-coverage-trace-compares"
else
echo "libfuzzer-sys only supports Linux and macOS" 1>&2
exit 1
fi
cargo update
cargo build --target $TARGET --verbose
cd ..