Skip to content

Commit

Permalink
go: Fix fuzzer building to fail on error
Browse files Browse the repository at this point in the history
  • Loading branch information
jberci committed Oct 5, 2020
1 parent 9c16a41 commit 5255024
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions .buildkite/code.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ steps:
# TODO: Consider making this a part of the development Docker image.
- go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
- make -C go build-fuzz
soft_fail: true
retry:
<<: *retry_agent_failure
plugins:
Expand Down
6 changes: 3 additions & 3 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ if [ "$(FUZZ_NO_BUILD)" != "1" ]; then \
mkdir -p "$$WORKDIR"; \
pushd $$TARGETDIR >/dev/null; \
$(ECHO) "$(CYAN)*** Building fuzzer for $@...$(OFF)"; \
go-fuzz-build -o $$WORKDIR/fuzz.zip; \
go-fuzz-build -o $$WORKDIR/fuzz.zip || exit 1; \
popd >/dev/null; \
fi; \
if [ "$(FUZZ_BUILD_ONLY)" != "1" ]; then \
mkdir -p "$$WORKDIR"; \
cd "$$WORKDIR"; \
$(ECHO) "$(CYAN)*** Running fuzzer for $@...$(OFF)"; \
if [ "$(@D)" == "." ]; then \
go-fuzz -bin=$$WORKDIR/fuzz.zip -workdir=$$WORKDIR; \
go-fuzz -bin=$$WORKDIR/fuzz.zip -workdir=$$WORKDIR || exit 1; \
else \
go-fuzz -bin=$$WORKDIR/fuzz.zip -workdir=$$WORKDIR -func Fuzz$(@F); \
go-fuzz -bin=$$WORKDIR/fuzz.zip -workdir=$$WORKDIR -func Fuzz$(@F) || exit 1; \
fi; \
fi;
endef
Expand Down
13 changes: 7 additions & 6 deletions go/consensus/tendermint/fuzz/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/oasisprotocol/oasis-core/go/common/fuzz"
"github.com/oasisprotocol/oasis-core/go/consensus/api/transaction"
"github.com/oasisprotocol/oasis-core/go/consensus/tendermint/abci"
"github.com/oasisprotocol/oasis-core/go/consensus/tendermint/api"
epochtimemock "github.com/oasisprotocol/oasis-core/go/consensus/tendermint/apps/epochtime_mock"
registryApp "github.com/oasisprotocol/oasis-core/go/consensus/tendermint/apps/registry"
stakingApp "github.com/oasisprotocol/oasis-core/go/consensus/tendermint/apps/staking"
Expand All @@ -24,7 +25,7 @@ var (
txSigner signature.Signer = memory.NewTestSigner("consensus-fuzz")

// FuzzableApps is a list of ABCI apps the fuzzer can fuzz.
FuzzableApps []abci.Application = []abci.Application{
FuzzableApps []api.Application = []api.Application{
epochtimemock.New(),
registryApp.New(),
stakingApp.New(),
Expand All @@ -48,11 +49,11 @@ func Fuzz(data []byte) int {
var pruneCfg abci.PruneConfig

appConfig := &abci.ApplicationConfig{
DataDir: "/tmp/oasis-node-fuzz-consensus",
Pruning: pruneCfg,
HaltEpochHeight: 1000000,
MinGasPrice: 1,
CheckpointInterval: 1 * time.Minute,
DataDir: "/tmp/oasis-node-fuzz-consensus",
Pruning: pruneCfg,
HaltEpochHeight: 1000000,
MinGasPrice: 1,
CheckpointerCheckInterval: 1 * time.Minute,
}

// The muxer will start with the previous state, if it exists (the state database isn't cleared).
Expand Down
5 changes: 4 additions & 1 deletion go/storage/fuzz/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ var (
)

func init() {
signerFactory := file.NewFactory(identityDir, signature.SignerNode, signature.SignerP2P, signature.SignerConsensus)
signerFactory, err := file.NewFactory(identityDir, signature.SignerNode, signature.SignerP2P, signature.SignerConsensus)
if err != nil {
panic(err)
}
identity, err := identity.Load(identityDir, signerFactory)
if err != nil {
panic(err)
Expand Down

0 comments on commit 5255024

Please sign in to comment.