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

Make build-fuzz work again, test it on CI #2696

Merged
merged 1 commit into from
Feb 19, 2020
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
13 changes: 13 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ steps:
# to finish running in parallel before continuing.
- wait

###################################################
# Test that build-fuzz still works (only on master)
###################################################
- label: Test fuzz builds
branches: master
command:
- . .buildkite/scripts/skip_if_only_docs_changes.sh
# 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
plugins:
<<: *docker_plugin

#####################################
# Test jobs requiring build artifacts
#####################################
Expand Down
1 change: 1 addition & 0 deletions .changelog/2695.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make build-fuzz work again, test it on CI
6 changes: 4 additions & 2 deletions go/consensus/tendermint/abci/mux_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package abci

import (
"context"

upgrade "github.com/oasislabs/oasis-core/go/upgrade/api"
)

// MockABCIMux exports some of the muxer's internal methods for testing use.
Expand All @@ -22,8 +24,8 @@ func (mux *MockABCIMux) MockClose() {
}

// NewMockMux creates a new ABCI mux suitable for testing.
func NewMockMux(ctx context.Context, cfg *ApplicationConfig) (*MockABCIMux, error) {
mux, err := newABCIMux(ctx, cfg)
func NewMockMux(ctx context.Context, upgrader upgrade.Backend, cfg *ApplicationConfig) (*MockABCIMux, error) {
mux, err := newABCIMux(ctx, upgrader, cfg)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion go/consensus/tendermint/apps/staking/proposing_rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func (app *stakingApplication) rewardBlockProposing(ctx *abci.Context, stakeStat
if err != nil {
return fmt.Errorf("app state getting current epoch: %w", err)
}
if epoch == epochtime.EpochInvalid {
invalidEpoch := epochtime.EpochInvalid // Workaround for incorrect go-fuzz instrumentation.
if epoch == invalidEpoch {
ctx.Logger().Info("rewardBlockProposing: this block does not belong to an epoch. no block proposing reward")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion go/consensus/tendermint/fuzz/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/epochtime_mock"
registryApp "github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/registry"
stakingApp "github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/staking"
"github.com/oasislabs/oasis-core/go/upgrade"
)

var (
Expand Down Expand Up @@ -53,7 +54,7 @@ func Fuzz(data []byte) int {
}

// The muxer will start with the previous state, if it exists (the state database isn't cleared).
muxer, _ := abci.NewMockMux(ctx, appConfig)
muxer, _ := abci.NewMockMux(ctx, upgrade.NewDummyUpgradeManager(), appConfig)
defer muxer.MockClose()

for _, app := range FuzzableApps {
Expand Down
3 changes: 2 additions & 1 deletion go/storage/fuzz/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"io/ioutil"

"github.com/oasislabs/oasis-core/go/common"
"github.com/oasislabs/oasis-core/go/common/crypto/signature"
"github.com/oasislabs/oasis-core/go/common/crypto/signature/signers/file"
commonFuzz "github.com/oasislabs/oasis-core/go/common/fuzz"
Expand Down Expand Up @@ -40,7 +41,7 @@ func init() {
}

// Create the storage backend service.
storageBackend, err = storage.New(context.Background(), localDB, identity, nil, nil)
storageBackend, err = storage.New(context.Background(), localDB, common.Namespace{}, identity, nil, nil)
if err != nil {
panic(err)
}
Expand Down
3 changes: 2 additions & 1 deletion go/storage/fuzz/gencorpus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"io/ioutil"

"github.com/oasislabs/oasis-core/go/common"
commonFuzz "github.com/oasislabs/oasis-core/go/common/fuzz"
"github.com/oasislabs/oasis-core/go/common/identity"
"github.com/oasislabs/oasis-core/go/storage"
Expand All @@ -19,7 +20,7 @@ const (
)

func main() {
storage, err := storage.New(context.Background(), "/tmp/oasis-node-fuzz-storage", &identity.Identity{}, nil, nil)
storage, err := storage.New(context.Background(), "/tmp/oasis-node-fuzz-storage", common.Namespace{}, &identity.Identity{}, nil, nil)
if err != nil {
panic(err)
}
Expand Down