packer_test: compile packer with .exe for Windows

Since on Windows extensions are mandatory in order to have something
executable, we compile Packer with a `.exe` suffix during tests, so we
can use the executable afterwards to run tests with.
pull/13032/head
Lucas Bajolet 2 years ago committed by Lucas Bajolet
parent 7124cf81fa
commit f77da46b3f

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"
)
@ -21,6 +22,9 @@ func BuildTestPacker(t *testing.T) (string, error) {
packerCoreDir := filepath.Dir(testDir)
outBin := filepath.Join(os.TempDir(), fmt.Sprintf("packer_core-%d", rand.Int()))
if runtime.GOOS == "windows" {
outBin = fmt.Sprintf("%s.exe", outBin)
}
compileCommand := exec.Command("go", "build", "-C", packerCoreDir, "-o", outBin)
logs, err := compileCommand.CombinedOutput()

Loading…
Cancel
Save