Skip to content

Commit 4892993

Browse files
committed
fix tests: emit .exe binary path on windows
1 parent cef10a8 commit 4892993

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

internal/testutil/testutil.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,20 @@ func RepoRoot(t *testing.T) string {
2020
func BuildBinary(t *testing.T, root string) string {
2121
t.Helper()
2222
bin := filepath.Join(t.TempDir(), "proof")
23+
if runtime.GOOS == "windows" {
24+
bin += ".exe"
25+
}
2326
// #nosec G204 -- test helper executes a fixed go build command.
2427
cmd := exec.Command("go", "build", "-o", bin, "./cmd/proof")
2528
cmd.Dir = root
2629
out, err := cmd.CombinedOutput()
2730
if err != nil {
2831
t.Fatalf("build binary: %v: %s", err, string(out))
2932
}
30-
if _, err := os.Stat(bin); err == nil {
31-
return bin
32-
}
33-
if _, err := os.Stat(bin + ".exe"); err == nil {
34-
return bin + ".exe"
33+
if _, err := os.Stat(bin); err != nil {
34+
t.Fatalf("build binary output not found at %s: %v", bin, err)
3535
}
36-
t.Fatalf("build binary output not found at %s (or %s.exe)", bin, bin)
37-
return ""
36+
return bin
3837
}
3938

4039
func CommandExitCode(t *testing.T, err error) int {

0 commit comments

Comments
 (0)