add fuzzit.dev continous fuzzing integration

This commit is contained in:
Krzysztof Kowalczyk 2019-08-07 12:27:57 -07:00 committed by Yevgeny Pats
parent f891fd9875
commit f6cc95c4cb
4 changed files with 70 additions and 0 deletions

View file

@ -223,3 +223,19 @@ jobs:
submodules: false # avoid cloning ethereum/tests submodules: false # avoid cloning ethereum/tests
script: script:
- go run build/ci.go purge -store gethstore/builds -days 14 - go run build/ci.go purge -store gethstore/builds -days 14
# This builder does continuous fuzz testing
- stage: Fuzz-Tests
go: 1.12.x
services:
- docker
script:
- ./build/fuzzit.sh sanity
- stage: Fuzzit (Fuzzing)
env:
secure: "Gd0njFhyjzOSJc1ybygwQ1ObdHUW5ORCnNZSHPwuozMiFdcMbClq4gyJvQoZDWN5moUDCsZ1CFacvf1bUiiJ4N3MydnLpL+SaqKj9JVbk7Vzb32oBaztfmvhRUCDNM7g1jSTSGKcAJ9PA6QYxVQ10R95SzPOelGu5HTDRgL+Kcc="
if: branch = master AND type IN (push)
go: 1.12.x
script:
- ./build/fuzzit.sh fuzzing

View file

@ -8,6 +8,7 @@ https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/6874
[![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum) [![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum)
[![Travis](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![Travis](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum)
[![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv) [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv)
[![fuzzit](https://app.fuzzit.dev/badge?org_id=ethereum=master)](https://fuzzit.dev)
Automated builds are available for stable releases and the unstable master branch. Binary Automated builds are available for stable releases and the unstable master branch. Binary
archives are published at https://geth.ethereum.org/downloads/. archives are published at https://geth.ethereum.org/downloads/.

30
build/fuzzit.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
set -xe
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ -z ${1+x} ]; then
echo "must call with job type as first argument e.g. 'fuzzing' or 'sanity'"
echo "see https://github.com/fuzzitdev/example-go/blob/master/.travis.yml"
exit 1
fi
$DIR/libfuzzer_targets.sh
# submit fuzz targets to fuzzit.dev for continuous fuzzing
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.12/fuzzit_Linux_x86_64
chmod a+x fuzzit
for TARGET in "${TARGETS[@]}"
do
# create fuzzing target on the server if it doesn't already exist
./fuzzit create target ${TARGET} || true
# submit a new fuzzing job for that target
if [ $1 == "fuzzing" ]; then
./fuzzit auth ${FUZZIT_API_KEY}
./fuzzit create job --branch $TRAVIS_BRANCH --revision $TRAVIS_COMMIT ${TARGET} "./${TARGET}"
else
./fuzzit create job --local ethereum/${TARGET} "./${TARGET}"
fi
done

23
build/libfuzzer_targets.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -x
## go-fuzz doesn't support modules for now, so ensure we do everything
## in the old style GOPATH way
export GO111MODULE="off"
## Install go-fuzz
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
## build fuzz targets
TARGETS=("bitutil-fuzzer" "bn256-add-fuzzer" "bn256-mul-fuzzer" "bn256-pair-fuzzer")
go-fuzz-build -libfuzzer -o bitutil-fuzzer.a ./common/bitutil
go-fuzz-build -libfuzzer -func FuzzAdd -o bn256-add-fuzzer.a ./crypto/bn256
go-fuzz-build -libfuzzer -func FuzzMul -o bn256-mul-fuzzer.a ./crypto/bn256
go-fuzz-build -libfuzzer -func FuzzPair -o bn256-pair-fuzzer.a ./crypto/bn256
for TARGET in "${TARGETS[@]}"
do
clang -fsanitize=fuzzer ${TARGET}.a -o ${TARGET}
done