]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: convert TestGoGetNonPkg to the script framework
authorMichael Matloob <matloob@golang.org>
Wed, 8 Jan 2020 19:45:04 +0000 (14:45 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 19 Feb 2020 20:50:14 +0000 (20:50 +0000)
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Ieaddc20aebd0b71189f2ebc8f8e2758f1117bbed
Reviewed-on: https://go-review.googlesource.com/c/go/+/213826
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/go_test.go
src/cmd/go/testdata/script/get_non_pkg.txt [new file with mode: 0644]

index fa7a6af46434c7c8240fe33791c9d45a778b497b..f34a5c80a73b4d222ed0540e40e400ab7c026bcb 100644 (file)
@@ -1204,23 +1204,6 @@ func TestPackageNotStaleWithTrailingSlash(t *testing.T) {
        tg.wantNotStale("io", "", "with trailing slash in GOROOT, io listed as stale")
 }
 
-func TestGoGetNonPkg(t *testing.T) {
-       testenv.MustHaveExternalNetwork(t)
-       testenv.MustHaveExecPath(t, "git")
-
-       tg := testgo(t)
-       defer tg.cleanup()
-       tg.tempDir("gobin")
-       tg.setenv("GOPATH", tg.path("."))
-       tg.setenv("GOBIN", tg.path("gobin"))
-       tg.runFail("get", "-d", "golang.org/x/tools")
-       tg.grepStderr("golang.org/x/tools: no Go files", "missing error")
-       tg.runFail("get", "-d", "-u", "golang.org/x/tools")
-       tg.grepStderr("golang.org/x/tools: no Go files", "missing error")
-       tg.runFail("get", "-d", "golang.org/x/tools")
-       tg.grepStderr("golang.org/x/tools: no Go files", "missing error")
-}
-
 func TestGoGetTestOnlyPkg(t *testing.T) {
        testenv.MustHaveExternalNetwork(t)
        testenv.MustHaveExecPath(t, "git")
diff --git a/src/cmd/go/testdata/script/get_non_pkg.txt b/src/cmd/go/testdata/script/get_non_pkg.txt
new file mode 100644 (file)
index 0000000..a878530
--- /dev/null
@@ -0,0 +1,14 @@
+[!net] skip
+[!exec:git] skip
+
+env GOBIN=$WORK/tmp/gobin
+env GO111MODULE=off
+
+! go get -d golang.org/x/tools
+stderr 'golang.org/x/tools: no Go files'
+
+! go get -d -u golang.org/x/tools
+stderr 'golang.org/x/tools: no Go files'
+
+! go get -d golang.org/x/tools
+stderr 'golang.org/x/tools: no Go files'
\ No newline at end of file