diff --git a/tests/e2e/cmd.go b/tests/e2e/cmd.go index c8a7d11..37a56cc 100644 --- a/tests/e2e/cmd.go +++ b/tests/e2e/cmd.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "os/exec" + "runtime" "strings" "time" ) @@ -33,6 +34,9 @@ type LongRunCmd struct { func NewLongRunCmd(args []string, dir string, envs []string) *LongRunCmd { ctx, cancel := context.WithCancel(context.Background()) cmd := exec.CommandContext(ctx, args[0], args[1:]...) + if runtime.GOOS == "windows" { + cmd = exec.CommandContext(ctx, args[0]+".exe", args[1:]...) + } cmd.Dir = dir cmd.Env = append(os.Environ(), envs...) @@ -95,6 +99,9 @@ func RunShortRunCmd(args []string, dir string, envs []string) (string, error) { defer cancel() cmd := exec.CommandContext(ctx, args[0], args[1:]...) + if runtime.GOOS == "windows" { + cmd = exec.CommandContext(ctx, args[0]+".exe", args[1:]...) + } cmd.Dir = dir cmd.Env = append(os.Environ(), envs...) @@ -104,6 +111,9 @@ func RunShortRunCmd(args []string, dir string, envs []string) (string, error) { // SearchSymbolInBinary searches if the specified symbol is compiled into the bianry func SearchSymbolInBinary(dir string, binary string, symbol string) (bool, error) { + if runtime.GOOS == "windows" { + binary = binary + ".exe" + } output, err := RunShortRunCmd([]string{"go", "tool", "objdump", "-s", symbol, binary}, dir, nil) if err != nil { return false, fmt.Errorf("cannot lookup into the binary: %w", err)