Skip to content
Open
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
36 changes: 25 additions & 11 deletions accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2165,20 +2165,10 @@ func golangBindings(t *testing.T, overload bool) {
import (
"testing"

"github.com/ava-labs/subnet-evm/params"
"github.com/ava-labs/subnet-evm/plugin/evm/customtypes"
libevmparams "github.com/ava-labs/libevm/params"
libevmtypes "github.com/ava-labs/libevm/core/types"

%s
)

func Test%s(t *testing.T) {
customtypes.Register()
t.Cleanup(libevmtypes.TestOnlyClearRegisteredExtras)
params.RegisterExtras()
t.Cleanup(libevmparams.TestOnlyClearRegisteredExtras)

%s
}
`, tt.imports, tt.name, tt.tester)
Expand All @@ -2187,6 +2177,30 @@ func golangBindings(t *testing.T, overload bool) {
}
})
}

// We must also write a main_test.go file for libevm registrations.
mainTest := `
package bindtest

import (
"os"
"testing"

"github.com/ava-labs/subnet-evm/params"
"github.com/ava-labs/subnet-evm/plugin/evm/customtypes"
)

func TestMain(m *testing.M) {
customtypes.Register()
params.RegisterExtras()
os.Exit(m.Run())
}
`
mainPath := filepath.Join(pkg, "main_test.go")
if err := os.WriteFile(mainPath, []byte(mainTest), 0600); err != nil {
t.Fatalf("os.WriteFile(%q, 0600): %v", mainPath, err)
}

// Convert the package to go modules and use the current source for go-ethereum
moder := exec.Command(gocmd, "mod", "init", "bindtest")
moder.Dir = pkg
Expand All @@ -2205,7 +2219,7 @@ func golangBindings(t *testing.T, overload bool) {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "-v", "-count", "1")
cmd := exec.Command(gocmd, "test", "-v", "-count", "1", "-race")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
Expand Down
1 change: 0 additions & 1 deletion scripts/known_flakes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
TestChainIndexerWithChildren
TestClientCancelWebsocket
TestClientWebsocketLargeMessage
TestGolangBindings
TestMempoolEthTxsAppGossipHandling
TestResumeSyncAccountsTrieInterrupted
TestResyncNewRootAfterDeletes
Expand Down
Loading