diff options
| author | Christopher Crone <christopher.crone@docker.com> | 2017-09-12 14:53:20 +0200 |
|---|---|---|
| committer | Christopher Crone <christopher.crone@docker.com> | 2017-09-14 19:27:09 +0200 |
| commit | 86f9eb4a085a61b3355dc38452c47def806bf7c9 (patch) | |
| tree | bb676fb6ae80a014e0ea7eb6a341164183c4b025 /integration-cli/cli | |
| parent | f089a1df393228085c4895b8db0fa95128173398 (diff) | |
| download | docker-86f9eb4a085a61b3355dc38452c47def806bf7c9.tar.gz | |
Fixes for dnephin review
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
Diffstat (limited to 'integration-cli/cli')
| -rw-r--r-- | integration-cli/cli/build/fakestorage/fixtures.go | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/integration-cli/cli/build/fakestorage/fixtures.go b/integration-cli/cli/build/fakestorage/fixtures.go index 8a6bb137ad..b76a7d9207 100644 --- a/integration-cli/cli/build/fakestorage/fixtures.go +++ b/integration-cli/cli/build/fakestorage/fixtures.go @@ -39,27 +39,34 @@ func ensureHTTPServerImage(t testingT) { goarch = "amd64" } - goCmd, lookErr := exec.LookPath("go") + cpCmd, lookErr := exec.LookPath("cp") if lookErr != nil { t.Fatalf("could not build http server: %v", lookErr) } - cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") - cmd.Env = append(os.Environ(), []string{ - "CGO_ENABLED=0", - "GOOS=" + goos, - "GOARCH=" + goarch, - }...) - var out []byte - if out, err = cmd.CombinedOutput(); err != nil { - t.Fatalf("could not build http server: %s", string(out)) - } + if _, err = os.Stat("../contrib/httpserver/httpserver"); os.IsNotExist(err) { + goCmd, lookErr := exec.LookPath("go") + if lookErr != nil { + t.Fatalf("could not build http server: %v", lookErr) + } - cpCmd, lookErr := exec.LookPath("cp") - if lookErr != nil { - t.Fatalf("could not build http server: %v", lookErr) + cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") + cmd.Env = append(os.Environ(), []string{ + "CGO_ENABLED=0", + "GOOS=" + goos, + "GOARCH=" + goarch, + }...) + var out []byte + if out, err = cmd.CombinedOutput(); err != nil { + t.Fatalf("could not build http server: %s", string(out)) + } + } else { + if out, err := exec.Command(cpCmd, "../contrib/httpserver/httpserver", filepath.Join(tmp, "httpserver")).CombinedOutput(); err != nil { + t.Fatalf("could not copy http server: %v", string(out)) + } } - if out, err = exec.Command(cpCmd, "../contrib/httpserver/Dockerfile", filepath.Join(tmp, "Dockerfile")).CombinedOutput(); err != nil { + + if out, err := exec.Command(cpCmd, "../contrib/httpserver/Dockerfile", filepath.Join(tmp, "Dockerfile")).CombinedOutput(); err != nil { t.Fatalf("could not build http server: %v", string(out)) } |
