diff --git a/orderer/sbft/main/network_test.go b/orderer/sbft/main/network_test.go index f9f3fa8db76..f6c2a1e568c 100644 --- a/orderer/sbft/main/network_test.go +++ b/orderer/sbft/main/network_test.go @@ -45,7 +45,8 @@ import ( const keyfile = "testdata/key.pem" const maindir = "github.com/hyperledger/fabric/orderer/sbft/main" -const mainexe = "main" + +var mainexe = os.TempDir() + "/" + "sbft" type peer struct { id uint64 @@ -67,12 +68,16 @@ func skipInShortMode(t *testing.T) { } func build() { - buildcmd := exec.Command("go", "build", maindir) + buildcmd := exec.Command("go", "build", "-o", mainexe, maindir) buildcmd.Stdout = os.Stdout buildcmd.Stderr = os.Stderr panicOnError(buildcmd.Run()) } +func deleteExe() { + panicOnError(os.Remove(mainexe)) +} + func install() { installcmd := exec.Command("go", "install", maindir) installcmd.Stdout = os.Stdout @@ -82,8 +87,8 @@ func install() { func TestMain(m *testing.M) { build() - install() code := m.Run() + deleteExe() os.Exit(code) }