Skip to content
This repository was archived by the owner on Jul 22, 2020. It is now read-only.

Commit 9b2a80d

Browse files
committed
restructure example and tweak readme (fixes issue #3; fixes isssue #4)
1 parent 52913f9 commit 9b2a80d

5 files changed

+20
-10
lines changed

README.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is an example of how to integrate your [go-fuzz](https://github.com/dvyukov
88

99
This example will show the following steps:
1010
* [Building and running locally a simple go-fuzz target](#building-go-fuzz-target)
11-
* [Integrate the go-fuzz target with Fuzzit via Travis-CI](#integrating-with-fuzzit)
11+
* [Integrate the go-fuzz target with Fuzzit via Travis-CI](#integrating-with-fuzzit-from-ci)
1212

1313
Result:
1414
* Fuzzit will run the fuzz targets continuously on daily basis with the latest release.
@@ -82,7 +82,7 @@ go get github.com/fuzzitdev/example-go
8282

8383
```bash
8484
cd /go/src/github.com/fuzzitdev/example-go
85-
go-fuzz-build -libfuzzer -o fuzzer.a ./...
85+
go-fuzz-build -libfuzzer -o fuzzer.a .
8686
clang-9 -fsanitize=fuzzer fuzzer.a -o fuzzer
8787
```
8888

@@ -138,27 +138,33 @@ artifact_prefix='./'; Test unit written to ./crash-df779ced6b712c5fca247e465de2d
138138
Base64: RlVaWkk=
139139
```
140140

141+
## Integrating with Fuzzit from CI
141142

142-
## Integrating with Fuzzit
143-
144-
The integration with fuzzit is easy and consists of adding a travis stage, downloading the fuzzit cli,
145-
authenticating and uploading the fuzzer to fuzzit.
143+
The best way to integrate with Fuzzit is by adding a stage in your Contintous Build system
144+
(like Travis CI or Circle CI). In that stage:
145+
* build a fuzz target
146+
* download `fuzzit` cli
147+
* authenticate with `fuzzit auth`
148+
* create a fuzzing job by uploading fuzz target
146149

147150
here is the relevant snippet from the [./ci/fuzzit.sh](https://github.com/fuzzitdev/example-go/blob/master/ci/fuzzit.sh)
148151
which is being run by [.travis.yml](https://github.com/fuzzitdev/example-go/blob/master/.travis.yml)
149152

150153
```bash
151-
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v1.2.7/fuzzit_Linux_x86_64
154+
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.0.0/fuzzit_Linux_x86_64
152155
chmod a+x fuzzit
153156
./fuzzit auth ${FUZZIT_API_KEY}
154157
export TARGET_ID=2n6hO2dQzylLxX5GGhRG
155158
./fuzzit create job --type $1 --branch $TRAVIS_BRANCH --revision $TRAVIS_COMMIT $TARGET_ID ./fuzzer
156159
```
157160

158161
NOTE: In production it is advised to download a pinned version of the [CLI](https://github.com/fuzzitdev/fuzzit)
159-
like in the example. In development you can use latest with the following link:
160-
https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_\<Os\>_\<Arch\>
162+
like in the example. In development you can use latest version:
163+
https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_${OS}_${ARCH}.
164+
Valid values for `${OS}` are: `Linux`, `Darwin`, `Windows`.
165+
Valid values for `${ARCH}` are: `x86_64` and `i386`.
161166

167+
The steps are:
162168
* Authenticate with the API key (you should keep this secret) you can find in the fuzzit settings dashboard.
163169
* Upload the fuzzer via create job command and create the fuzzing job. In This example we use two type of jobs:
164170
* Fuzzing job which is run on every push to master which continuous the previous job just with the new release.

ci/fuzzit.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
set -xe
22

3+
## go-fuzz doesn't support modules for now, so ensure we do everything
4+
## in the old style GOPATH way
5+
export GO111MODULE="off"
6+
37
if [ -z ${1+x} ]; then
48
echo "must call with job type as first argument e.g. 'fuzzing' or 'sanity'"
59
echo "see https://github.com/fuzzitdev/example-go/blob/master/.travis.yml"
@@ -11,7 +15,7 @@ go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-
1115

1216
## build and send to fuzzit
1317
go build ./...
14-
go-fuzz-build -libfuzzer -o fuzzer.a ./...
18+
go-fuzz-build -libfuzzer -o fuzzer.a .
1519
clang -fsanitize=fuzzer fuzzer.a -o fuzzer
1620

1721
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.0.0/fuzzit_Linux_x86_64
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)