Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzit: use go-fuzz with go-modules support #1022

Merged
merged 1 commit into from
Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
fuzzit:
docker:
- image: fuzzitdev/fuzzit:golang1.12-stretch-llvm9
working_directory: /go/src/github.com/grpc-gateway/grpc-gateway
working_directory: /src/grpc-gateway
steps:
- checkout
- setup_remote_docker
Expand Down
20 changes: 9 additions & 11 deletions fuzzit.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/bin/bash
set -xe

# Go-fuzz doesn't support modules yet, so ensure we do everything in the old style GOPATH way
export GO111MODULE="off"
# We use fuzzit fork until go-fuzz will support go-modules
mkdir -p /go/src/github.com/dvyukov
cd /go/src/github.com/dvyukov
git clone https://github.com/fuzzitdev/go-fuzz
cd go-fuzz
go get ./...
go build ./...

# Install go-fuzz
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build

# Compiling fuzz targets in fuzz.go with go-fuzz (https://github.com/dvyukov/go-fuzz) and libFuzzer support
# This is a workaround until go-fuzz has gomodules support https://github.com/dvyukov/go-fuzz/issues/195
BRANCH=$(git rev-parse --abbrev-ref HEAD)
git branch --set-upstream-to=origin/master $BRANCH

go get -v -u ./protoc-gen-grpc-gateway/httprule
#go get -v -u ./protoc-gen-grpc-gateway/httprule
cd /src/grpc-gateway
go-fuzz-build -libfuzzer -o parse-http-rule.a ./protoc-gen-grpc-gateway/httprule
clang-9 -fsanitize=fuzzer parse-http-rule.a -o parse-http-rule

Expand Down