251
|
1 |
#!/bin/bash |
|
2 |
set -xe |
|
3 |
|
|
4 |
# go-fuzz doesn't support modules yet, so ensure we do everything |
|
5 |
# in the old style GOPATH way |
|
6 |
export GO111MODULE="off" |
|
7 |
|
|
8 |
# install go-fuzz |
|
9 |
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build |
|
10 |
|
|
11 |
# target name can only contain lower-case letters (a-z), digits (0-9) and a dash (-) |
|
12 |
# to add another target, make sure to create it with `fuzzit create target` |
|
13 |
# before using `fuzzit create job` |
|
14 |
TARGET=toml-fuzzer |
|
15 |
|
|
16 |
go-fuzz-build -libfuzzer -o ${TARGET}.a github.com/pelletier/go-toml |
|
17 |
clang -fsanitize=fuzzer ${TARGET}.a -o ${TARGET} |
|
18 |
|
|
19 |
# install fuzzit for talking to fuzzit.dev service |
|
20 |
# or latest version: |
|
21 |
# https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_Linux_x86_64 |
|
22 |
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.52/fuzzit_Linux_x86_64 |
|
23 |
chmod a+x fuzzit |
|
24 |
|
|
25 |
# TODO: change kkowalczyk to go-toml and create toml-fuzzer target there |
|
26 |
./fuzzit create job --type $TYPE go-toml/${TARGET} ${TARGET} |