From 647741721cd06efd0bd17ca7f7a85ae2264a6fe7 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 18 Nov 2019 14:28:15 -0500 Subject: [PATCH] cmd/go: convert TestIssue6844 to a script test It was attempting to write a test binary to the working directory. Updates #28387 Updates #30316 Change-Id: I82eca3a8a3e019dc6dacbe1f02a0583577694b93 Reviewed-on: https://go-review.googlesource.com/c/go/+/207614 Run-TryBot: Bryan C. Mills Reviewed-by: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/cmd/go/go_test.go | 13 ------------- src/cmd/go/testdata/dep_test.go | 7 ------- src/cmd/go/testdata/script/test_rebuildall.txt | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 src/cmd/go/testdata/dep_test.go create mode 100644 src/cmd/go/testdata/script/test_rebuildall.txt diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 0a5021e459..aaeb42d98c 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -2711,19 +2711,6 @@ func TestIssue7108(t *testing.T) { tg.runFail("test", "notest") } -// cmd/go: go test -a foo does not rebuild regexp. -func TestIssue6844(t *testing.T) { - if testing.Short() { - t.Skip("don't rebuild the standard library in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("deps.test" + exeSuffix) - tg.run("test", "-x", "-a", "-c", "testdata/dep_test.go") - tg.grepStderr("regexp", "go test -x -a -c testdata/dep-test.go did not rebuild regexp") -} - func TestGoBuildTestOnly(t *testing.T) { tg := testgo(t) defer tg.cleanup() diff --git a/src/cmd/go/testdata/dep_test.go b/src/cmd/go/testdata/dep_test.go deleted file mode 100644 index ac39a5bb1c..0000000000 --- a/src/cmd/go/testdata/dep_test.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package deps - -import _ "testing" diff --git a/src/cmd/go/testdata/script/test_rebuildall.txt b/src/cmd/go/testdata/script/test_rebuildall.txt new file mode 100644 index 0000000000..38233c1892 --- /dev/null +++ b/src/cmd/go/testdata/script/test_rebuildall.txt @@ -0,0 +1,14 @@ +env GO111MODULE=off + +# Regression test for golang.org/issue/6844: +# 'go test -a' should force dependencies in the standard library to be rebuilt. + +[short] skip + +go test -x -a -c testdata/dep_test.go +stderr '^.*[/\\]compile'$GOEXE'["]? (.* )?regexp .*[/\\]regexp\.go' + +-- testdata/dep_test.go -- +package deps + +import _ "testing" -- 2.50.0