From f4ec85486a1532594c5009e3c0b9903cbb93e844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 18 Nov 2019 15:39:39 +0200 Subject: [PATCH] accounts/abi/bind: switch binding test to go modules --- accounts/abi/bind/bind_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index 333b1d5a8..e0b282494 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -1320,7 +1320,7 @@ var bindTests = []struct { event bar(uint256 i); event bar(uint256 i, uint256 j); - + function foo(uint256 i) public { emit bar(i); } @@ -1502,6 +1502,18 @@ func TestGolangBindings(t *testing.T) { t.Fatalf("test %d: failed to write tests: %v", i, 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 + if out, err := moder.CombinedOutput(); err != nil { + t.Fatalf("failed to convert binding test to modules: %v\n%s", err, out) + } + pwd, _ := os.Getwd() + replacer := exec.Command(gocmd, "mod", "edit", "-replace", "github.com/ethereum/go-ethereum="+filepath.Join(pwd, "..", "..", "..")) // Repo root + replacer.Dir = pkg + if out, err := replacer.CombinedOutput(); err != nil { + t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out) + } // Test the entire package and report any failures cmd := exec.Command(gocmd, "test", "-v", "-count", "1") cmd.Dir = pkg