mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 08:42:33 -04:00
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.
This commit is contained in:
parent
7124cf81fa
commit
f77da46b3f
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Reference in a new issue