@@ -845,22 +845,33 @@ func Benchmark100ConcurrentContractCalls(b *testing.B) {
845
845
b .ResetTimer ()
846
846
for n := 0 ; n < b .N ; n ++ {
847
847
var wg sync.WaitGroup
848
+ errChan := make (chan error , callCount )
849
+ resChan := make (chan []byte , callCount )
848
850
wg .Add (callCount )
851
+ testMutex .Lock ()
852
+ info = MockInfoBin (b , "fred" )
853
+ testMutex .Unlock ()
849
854
for i := 0 ; i < callCount ; i ++ {
850
855
go func () {
856
+ defer wg .Done ()
851
857
gasMeter2 := NewMockGasMeter (TESTING_GAS_LIMIT )
852
858
igasMeter2 := types .GasMeter (gasMeter2 )
853
859
store .SetGasMeter (gasMeter2 )
854
- info = MockInfoBin (b , "fred" )
855
860
msg := []byte (`{"allocate_large_memory":{"pages":0}}` ) // replace with noop once we have it
856
861
res , _ , err = Execute (cache , checksum , env , info , msg , & igasMeter2 , store , api , & querier , TESTING_GAS_LIMIT , TESTING_PRINT_DEBUG )
857
- require .NoError (b , err )
858
- requireOkResponse (b , res , 0 )
859
-
860
- wg .Done ()
862
+ errChan <- err
863
+ resChan <- res
861
864
}()
862
865
}
863
866
wg .Wait ()
867
+ close (errChan )
868
+ close (resChan )
869
+
870
+ // Now check results in the main test goroutine
871
+ for i := 0 ; i < callCount ; i ++ {
872
+ require .NoError (b , <- errChan )
873
+ requireOkResponse (b , <- resChan , 0 )
874
+ }
864
875
}
865
876
}
866
877
@@ -1312,10 +1323,6 @@ func TestCustomReflectQuerier(t *testing.T) {
1312
1323
// https://github.com/CosmWasm/cosmwasm/blob/v0.11.0-alpha3/contracts/reflect/src/msg.rs#L18-L28
1313
1324
}
1314
1325
1315
- type CapitalizedResponse struct {
1316
- Text string `json:"text"`
1317
- }
1318
-
1319
1326
cache , cleanup := withCache (t )
1320
1327
defer cleanup ()
1321
1328
checksum := createReflectContract (t , cache )
@@ -1354,6 +1361,10 @@ func TestCustomReflectQuerier(t *testing.T) {
1354
1361
require .Equal (t , "SMALL FRYS :)" , response .Text )
1355
1362
}
1356
1363
1364
+ type CapitalizedResponse struct {
1365
+ Text string `json:"text"`
1366
+ }
1367
+
1357
1368
// TestFloats is a port of the float_instrs_are_deterministic test in cosmwasm-vm
1358
1369
func TestFloats (t * testing.T ) {
1359
1370
type Value struct {
0 commit comments