Skip to content

Commit

Permalink
remove t.parralel and add mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
DIGIX666 committed Sep 22, 2024
1 parent d9fa4e9 commit 09aaa02
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 142 deletions.
3 changes: 0 additions & 3 deletions gno.land/pkg/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import (
)

func TestTestdata(t *testing.T) {

Check failure on line 11 in gno.land/pkg/integration/integration_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

RunGnolandTestscripts(t, "testdata")
}

func TestUnquote(t *testing.T) {

Check failure on line 16 in gno.land/pkg/integration/integration_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cases := []struct {
Input string
Expand All @@ -40,7 +38,6 @@ func TestUnquote(t *testing.T) {
for _, tc := range cases {
tc := tc
t.Run(tc.Input, func(t *testing.T) {

Check failure on line 40 in gno.land/pkg/integration/integration_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

// split by whitespace to simulate command-line arguments
args := strings.Split(tc.Input, " ")
Expand Down
10 changes: 7 additions & 3 deletions gnovm/stdlibs/bytes/bytes_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package bytes_test
import (
"bytes"
"fmt"
// "internal/testenv" XXX remove
// "reflect" XXX remove
"math/rand"
"strings"
"testing"
Expand Down Expand Up @@ -518,9 +520,11 @@ func valName(x int) string {

func benchBytes(b *testing.B, sizes []int, f func(b *testing.B, n int)) {
for _, n := range sizes {
// if isRaceBuilder && n > 4<<10 {
// continue
// }
/* XXX remove testenv
if isRaceBuilder && n > 4<<10 {
continue
}
*/

b.Run(valName(n), func(b *testing.B) {
if len(bmbuf) < n {
Expand Down
2 changes: 1 addition & 1 deletion gnovm/stdlibs/bytes/compare_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestCompareBytes(t *testing.T) {
}
lengths = append(lengths, 256, 512, 1024, 1333, 4095, 4096, 4097)

if !testing.Short() {
if !testing.Short() { // XXX remove testenv: || testenv.Builder() != "" {
lengths = append(lengths, 65535, 65536, 65537, 99999)
}

Expand Down
5 changes: 2 additions & 3 deletions gnovm/stdlibs/sort/sort_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ func countOps(t *testing.T, algo func(sort.Interface), name string) {
func TestCountStableOps(t *testing.T) { countOps(t, sort.Stable, "Stable") }
func TestCountSortOps(t *testing.T) { countOps(t, sort.Sort, "Sort ") }

/*
/* XXX removed due to testenv
func bench(b *testing.B, size int, algo func(Interface), name string) {
if os.Getenv("RACE") == "true" && size > 1e4 {
if stringspkg.HasSuffix(testenv.Builder(), "-race") && size > 1e4 {
b.Skip("skipping slow benchmark on race builder")
}
b.StopTimer()
Expand Down Expand Up @@ -685,7 +685,6 @@ func bench(b *testing.B, size int, algo func(Interface), name string) {
}
}
func BenchmarkSort1e2(b *testing.B) { bench(b, 1e2, Sort, "Sort") }
func BenchmarkStable1e2(b *testing.B) { bench(b, 1e2, Stable, "Stable") }
func BenchmarkSort1e4(b *testing.B) { bench(b, 1e4, Sort, "Sort") }
Expand Down
20 changes: 0 additions & 20 deletions tm2/pkg/amino/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,64 +22,54 @@ import (
// Non-interface Google fuzz tests

func TestCodecStruct(t *testing.T) {

Check failure on line 24 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

for _, ptr := range tests.StructTypes {
t.Logf("case %v", reflect.TypeOf(ptr))
rt := getTypeFromPointer(ptr)
name := rt.Name()
t.Run(name+":binary", func(t *testing.T) {
t.Parallel()
_testCodec(t, rt, "binary")
})
t.Run(name+":json", func(t *testing.T) {
t.Parallel()
_testCodec(t, rt, "json")
})
}
}

func TestCodecDef(t *testing.T) {

Check failure on line 39 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

for _, ptr := range tests.DefTypes {
t.Logf("case %v", reflect.TypeOf(ptr))
rt := getTypeFromPointer(ptr)
name := rt.Name()
t.Run(name+":binary", func(t *testing.T) {
t.Parallel()
_testCodec(t, rt, "binary")
})
t.Run(name+":json", func(t *testing.T) {
t.Parallel()
_testCodec(t, rt, "json")
})
}
}

func TestDeepCopyStruct(t *testing.T) {

Check failure on line 54 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

for _, ptr := range tests.StructTypes {
t.Logf("case %v", reflect.TypeOf(ptr))
rt := getTypeFromPointer(ptr)
name := rt.Name()
t.Run(name+":deepcopy", func(t *testing.T) {
t.Parallel()
_testDeepCopy(t, rt)
})
}
}

func TestDeepCopyDef(t *testing.T) {

Check failure on line 66 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

for _, ptr := range tests.DefTypes {
t.Logf("case %v", reflect.TypeOf(ptr))
rt := getTypeFromPointer(ptr)
name := rt.Name()
t.Run(name+":deepcopy", func(t *testing.T) {
t.Parallel()
_testDeepCopy(t, rt)
})
}
Expand Down Expand Up @@ -220,7 +210,6 @@ func _testDeepCopy(t *testing.T, rt reflect.Type) {
// Register/interface tests

func TestCodecMashalFailsOnUnregisteredConcrete(t *testing.T) {

Check failure on line 212 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()

Expand All @@ -230,7 +219,6 @@ func TestCodecMashalFailsOnUnregisteredConcrete(t *testing.T) {
}

func TestCodecMarshalPassesOnRegistered(t *testing.T) {

Check failure on line 221 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.Concrete1{}), tests.Package)
Expand All @@ -249,7 +237,6 @@ func TestCodecMarshalPassesOnRegistered(t *testing.T) {
}

func TestCodecRegisterAndMarshalMultipleConcrete(t *testing.T) {

Check failure on line 239 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.Concrete1{}), tests.Package)
Expand Down Expand Up @@ -286,7 +273,6 @@ func TestCodecRegisterAndMarshalMultipleConcrete(t *testing.T) {

// Serialize and deserialize a registered typedef.
func TestCodecRoundtripNonNilRegisteredTypeDef(t *testing.T) {

Check failure on line 275 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteTypeDef{}), tests.Package)
Expand Down Expand Up @@ -361,7 +347,6 @@ func TestCodecRoundtripNonNilRegisteredTypeDef(t *testing.T) {
// Exactly like TestCodecRoundtripNonNilRegisteredTypeDef but with struct
// around the value instead of a type def.
func TestCodecRoundtripNonNilRegisteredWrappedValue(t *testing.T) {

Check failure on line 349 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteWrappedBytes{}), tests.Package)
Expand Down Expand Up @@ -393,7 +378,6 @@ func TestCodecRoundtripNonNilRegisteredWrappedValue(t *testing.T) {

// MarshalAny(msg) and Marshal(&msg) are the same.
func TestCodecMarshalAny(t *testing.T) {

Check failure on line 380 in tm2/pkg/amino/reflect_test.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

unnecessary leading newline (whitespace)
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteWrappedBytes{}), tests.Package)
Expand All @@ -412,7 +396,6 @@ func TestCodecMarshalAny(t *testing.T) {

// Like TestCodecRoundtripNonNilRegisteredTypeDef, but JSON.
func TestCodecJSONRoundtripNonNilRegisteredTypeDef(t *testing.T) {
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteTypeDef{}), tests.Package)
Expand All @@ -434,7 +417,6 @@ func TestCodecJSONRoundtripNonNilRegisteredTypeDef(t *testing.T) {

// Like TestCodecRoundtripNonNilRegisteredTypeDef, but serialize the concrete value directly.
func TestCodecRoundtripMarshalOnConcreteNonNilRegisteredTypeDef(t *testing.T) {
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteTypeDef{}), tests.Package)
Expand Down Expand Up @@ -467,7 +449,6 @@ func TestCodecRoundtripMarshalOnConcreteNonNilRegisteredTypeDef(t *testing.T) {

// Like TestCodecRoundtripNonNilRegisteredTypeDef but read into concrete var.
func TestCodecRoundtripUnmarshalOnConcreteNonNilRegisteredTypeDef(t *testing.T) {
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.ConcreteTypeDef{}), tests.Package)
Expand All @@ -488,7 +469,6 @@ func TestCodecRoundtripUnmarshalOnConcreteNonNilRegisteredTypeDef(t *testing.T)
}

func TestCodecBinaryStructFieldNilInterface(t *testing.T) {
t.Parallel()

cdc := amino.NewCodec()
cdc.RegisterTypeFrom(reflect.TypeOf(tests.InterfaceFieldsStruct{}), tests.Package)
Expand Down
2 changes: 2 additions & 0 deletions tm2/pkg/bft/consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func (vss ValidatorStubsByAddress) Swap(i, j int) {

func startFrom(cs *ConsensusState, height int64, round int) {
go func() {
cs.mu.Lock()
defer cs.mu.Unlock()
cs.enterNewRound(height, round)
cs.StartWithoutWALCatchup()
}()
Expand Down
4 changes: 0 additions & 4 deletions tm2/pkg/bft/consensus/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func assertMempool(txn txNotifier) mempl.Mempool {
}

func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) {
t.Parallel()

config, _ := ResetConfig("consensus_mempool_no_progress_until_txs_available")
defer os.RemoveAll(config.RootDir)
Expand Down Expand Up @@ -73,7 +72,6 @@ func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) {
}

func TestMempoolProgressInHigherRound(t *testing.T) {
t.Parallel()

config, _ := ResetConfig("consensus_mempool_progress_in_higher_round")
defer os.RemoveAll(config.RootDir)
Expand Down Expand Up @@ -142,7 +140,6 @@ func deliverTxsRange(cs *ConsensusState, start, end int) {
}

func TestMempoolTxConcurrentWithCommit(t *testing.T) {
t.Parallel()

state, privVals := randGenesisState(1, false, 10)
blockDB := memdb.NewMemDB()
Expand Down Expand Up @@ -175,7 +172,6 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) {
}

func TestMempoolRmBadTx(t *testing.T) {
t.Parallel()

state, privVals := randGenesisState(1, false, 10)
app := NewCounterApplication()
Expand Down
Loading

0 comments on commit 09aaa02

Please sign in to comment.