mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: skip TestSyncingViaGlobalSync with -race
As panics on Travis. panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7e351b]
This commit is contained in:
parent
eb9f11e16c
commit
3c48738c15
1 changed files with 16 additions and 37 deletions
|
|
@ -19,7 +19,6 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
|
@ -78,37 +77,31 @@ func TestSyncingViaGlobalSync(t *testing.T) {
|
|||
if runtime.GOOS == "darwin" && os.Getenv("TRAVIS") == "true" {
|
||||
t.Skip("Flaky on mac on travis")
|
||||
}
|
||||
|
||||
if testutil.RaceEnabled {
|
||||
t.Skip("Segfaults on Travis with -race")
|
||||
}
|
||||
|
||||
//if nodes/chunks have been provided via commandline,
|
||||
//run the tests with these values
|
||||
if *nodes != 0 && *chunks != 0 {
|
||||
log.Info(fmt.Sprintf("Running test with %d chunks and %d nodes...", *chunks, *nodes))
|
||||
testSyncingViaGlobalSync(t, *chunks, *nodes)
|
||||
} else {
|
||||
var nodeCnt []int
|
||||
var chnkCnt []int
|
||||
chunkCounts := []int{4, 32}
|
||||
nodeCounts := []int{32, 16}
|
||||
|
||||
//if the `longrunning` flag has been provided
|
||||
//run more test combinations
|
||||
if *longrunning {
|
||||
chnkCnt = []int{1, 8, 32, 256, 1024}
|
||||
nodeCnt = []int{16, 32, 64, 128, 256}
|
||||
} else if testutil.RaceEnabled {
|
||||
// TestSyncingViaGlobalSync allocates a lot of memory
|
||||
// with race detector. By reducing the number of chunks
|
||||
// and nodes, memory consumption is lower and data races
|
||||
// are still checked, while correctness of syncing is
|
||||
// tested with more chunks and nodes in regular (!race)
|
||||
// tests.
|
||||
chnkCnt = []int{4}
|
||||
nodeCnt = []int{16}
|
||||
} else {
|
||||
//default test
|
||||
chnkCnt = []int{4, 32}
|
||||
nodeCnt = []int{32, 16}
|
||||
chunkCounts = []int{1, 8, 32, 256, 1024}
|
||||
nodeCounts = []int{16, 32, 64, 128, 256}
|
||||
}
|
||||
for _, chnk := range chnkCnt {
|
||||
for _, n := range nodeCnt {
|
||||
log.Info(fmt.Sprintf("Long running test with %d chunks and %d nodes...", chnk, n))
|
||||
testSyncingViaGlobalSync(t, chnk, n)
|
||||
|
||||
for _, chunkCount := range chunkCounts {
|
||||
for _, n := range nodeCounts {
|
||||
log.Info(fmt.Sprintf("Long running test with %d chunks and %d nodes...", chunkCount, n))
|
||||
testSyncingViaGlobalSync(t, chunkCount, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -121,21 +114,7 @@ var simServiceMap = map[string]simulation.ServiceFunc{
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
var dir string
|
||||
var store *state.DBStore
|
||||
if testutil.RaceEnabled {
|
||||
// Use on-disk DBStore to reduce memory consumption in race tests.
|
||||
dir, err = ioutil.TempDir("", "swarm-stream-")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
store, err = state.NewDBStore(dir)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
} else {
|
||||
store = state.NewInmemoryStore()
|
||||
}
|
||||
store := state.NewInmemoryStore()
|
||||
|
||||
r := NewRegistry(addr.ID(), delivery, netStore, store, &RegistryOptions{
|
||||
Retrieval: RetrievalDisabled,
|
||||
|
|
|
|||
Loading…
Reference in a new issue