@@ -19,7 +19,6 @@ import (
1919 "context"
2020 "errors"
2121 "fmt"
22- "io/ioutil"
2322 "os"
2423 "runtime"
2524 "sync"
@@ -78,37 +77,31 @@ func TestSyncingViaGlobalSync(t *testing.T) {
7877 if runtime .GOOS == "darwin" && os .Getenv ("TRAVIS" ) == "true" {
7978 t .Skip ("Flaky on mac on travis" )
8079 }
80+
81+ if testutil .RaceEnabled {
82+ t .Skip ("Segfaults on Travis with -race" )
83+ }
84+
8185 //if nodes/chunks have been provided via commandline,
8286 //run the tests with these values
8387 if * nodes != 0 && * chunks != 0 {
8488 log .Info (fmt .Sprintf ("Running test with %d chunks and %d nodes..." , * chunks , * nodes ))
8589 testSyncingViaGlobalSync (t , * chunks , * nodes )
8690 } else {
87- var nodeCnt []int
88- var chnkCnt []int
91+ chunkCounts := []int {4 , 32 }
92+ nodeCounts := []int {32 , 16 }
93+
8994 //if the `longrunning` flag has been provided
9095 //run more test combinations
9196 if * longrunning {
92- chnkCnt = []int {1 , 8 , 32 , 256 , 1024 }
93- nodeCnt = []int {16 , 32 , 64 , 128 , 256 }
94- } else if testutil .RaceEnabled {
95- // TestSyncingViaGlobalSync allocates a lot of memory
96- // with race detector. By reducing the number of chunks
97- // and nodes, memory consumption is lower and data races
98- // are still checked, while correctness of syncing is
99- // tested with more chunks and nodes in regular (!race)
100- // tests.
101- chnkCnt = []int {4 }
102- nodeCnt = []int {16 }
103- } else {
104- //default test
105- chnkCnt = []int {4 , 32 }
106- nodeCnt = []int {32 , 16 }
97+ chunkCounts = []int {1 , 8 , 32 , 256 , 1024 }
98+ nodeCounts = []int {16 , 32 , 64 , 128 , 256 }
10799 }
108- for _ , chnk := range chnkCnt {
109- for _ , n := range nodeCnt {
110- log .Info (fmt .Sprintf ("Long running test with %d chunks and %d nodes..." , chnk , n ))
111- testSyncingViaGlobalSync (t , chnk , n )
100+
101+ for _ , chunkCount := range chunkCounts {
102+ for _ , n := range nodeCounts {
103+ log .Info (fmt .Sprintf ("Long running test with %d chunks and %d nodes..." , chunkCount , n ))
104+ testSyncingViaGlobalSync (t , chunkCount , n )
112105 }
113106 }
114107 }
@@ -121,21 +114,7 @@ var simServiceMap = map[string]simulation.ServiceFunc{
121114 return nil , nil , err
122115 }
123116
124- var dir string
125- var store * state.DBStore
126- if testutil .RaceEnabled {
127- // Use on-disk DBStore to reduce memory consumption in race tests.
128- dir , err = ioutil .TempDir ("" , "swarm-stream-" )
129- if err != nil {
130- return nil , nil , err
131- }
132- store , err = state .NewDBStore (dir )
133- if err != nil {
134- return nil , nil , err
135- }
136- } else {
137- store = state .NewInmemoryStore ()
138- }
117+ store := state .NewInmemoryStore ()
139118
140119 r := NewRegistry (addr .ID (), delivery , netStore , store , & RegistryOptions {
141120 Retrieval : RetrievalDisabled ,
0 commit comments