aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pack
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-08-30 11:08:47 -0700
committerKeith Randall <khr@golang.org>2016-08-30 22:49:11 +0000
commit842b05832fb5088a212e30962f58c95a38296d32 (patch)
tree7454308e3546c1f3cd8ba9901ec282aa453b1645 /src/cmd/pack
parentbe23e98e06b1e1c65de19d460537c4df21ebf555 (diff)
downloadgo-842b05832fb5088a212e30962f58c95a38296d32.tar.gz
go-842b05832fb5088a212e30962f58c95a38296d32.zip
all: use testing.GoToolPath instead of "go"
This change makes sure that tests are run with the correct version of the go tool. The correct version is the one that we invoked with "go test", not the one that is first in our path. Fixes #16577 Change-Id: If22c8f8c3ec9e7c35d094362873819f2fbb8559b Reviewed-on: https://go-review.googlesource.com/28089 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/pack')
-rw-r--r--src/cmd/pack/pack_test.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/cmd/pack/pack_test.go b/src/cmd/pack/pack_test.go
index c305a87b57..79d9cde292 100644
--- a/src/cmd/pack/pack_test.go
+++ b/src/cmd/pack/pack_test.go
@@ -218,10 +218,11 @@ func TestHello(t *testing.T) {
return doRun(t, dir, args...)
}
- run("go", "build", "cmd/pack") // writes pack binary to dir
- run("go", "tool", "compile", "hello.go")
+ goBin := testenv.GoToolPath(t)
+ run(goBin, "build", "cmd/pack") // writes pack binary to dir
+ run(goBin, "tool", "compile", "hello.go")
run("./pack", "grc", "hello.a", "hello.o")
- run("go", "tool", "link", "-o", "a.out", "hello.a")
+ run(goBin, "tool", "link", "-o", "a.out", "hello.a")
out := run("./a.out")
if out != "hello world\n" {
t.Fatalf("incorrect output: %q, want %q", out, "hello world\n")
@@ -282,11 +283,12 @@ func TestLargeDefs(t *testing.T) {
return doRun(t, dir, args...)
}
- run("go", "build", "cmd/pack") // writes pack binary to dir
- run("go", "tool", "compile", "large.go")
+ goBin := testenv.GoToolPath(t)
+ run(goBin, "build", "cmd/pack") // writes pack binary to dir
+ run(goBin, "tool", "compile", "large.go")
run("./pack", "grc", "large.a", "large.o")
- run("go", "tool", "compile", "-I", ".", "main.go")
- run("go", "tool", "link", "-L", ".", "-o", "a.out", "main.o")
+ run(goBin, "tool", "compile", "-I", ".", "main.go")
+ run(goBin, "tool", "link", "-L", ".", "-o", "a.out", "main.o")
out := run("./a.out")
if out != "ok\n" {
t.Fatalf("incorrect output: %q, want %q", out, "ok\n")