From cde230b8b354200678a79b0d5fe8263f34f46d45 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Fri, 3 Jan 2020 17:03:42 -0500 Subject: [PATCH] cmd/go: remove tests using testdata/flag_test.go Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: I6573185cf14f298c51f76265f18a75e4960ce791 Reviewed-on: https://go-review.googlesource.com/c/go/+/213220 Run-TryBot: Michael Matloob Reviewed-by: Bryan C. Mills --- src/cmd/go/go_test.go | 16 ---------------- .../{flag_test.go => script/test_flag.txt} | 6 ++++++ src/cmd/go/testdata/script/test_minus_n.txt | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 16 deletions(-) rename src/cmd/go/testdata/{flag_test.go => script/test_flag.txt} (58%) create mode 100644 src/cmd/go/testdata/script/test_minus_n.txt diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 77917b84b67..0d657b2ef87 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -2602,14 +2602,6 @@ func TestGoTestMainTwice(t *testing.T) { } } -func TestGoTestFlagsAfterPackage(t *testing.T) { - tooSlow(t) - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/flag_test.go", "-v", "-args", "-v=7") // Two distinct -v flags. - tg.run("test", "-v", "testdata/flag_test.go", "-args", "-v=7") // Two distinct -v flags. -} - func TestGoTestXtestonlyWorks(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -4767,14 +4759,6 @@ func TestInstallDeps(t *testing.T) { tg.mustExist(p1) } -func TestGoTestMinusN(t *testing.T) { - // Intent here is to verify that 'go test -n' works without crashing. - // This reuses flag_test.go, but really any test would do. - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/flag_test.go", "-n", "-args", "-v=7") -} - func TestGoTestJSON(t *testing.T) { skipIfGccgo(t, "gccgo does not have standard packages") tooSlow(t) diff --git a/src/cmd/go/testdata/flag_test.go b/src/cmd/go/testdata/script/test_flag.txt similarity index 58% rename from src/cmd/go/testdata/flag_test.go rename to src/cmd/go/testdata/script/test_flag.txt index ddf613d8701..bbcad1c59c6 100644 --- a/src/cmd/go/testdata/flag_test.go +++ b/src/cmd/go/testdata/script/test_flag.txt @@ -1,3 +1,9 @@ +[short] skip + +go test flag_test.go -v -args -v=7 # Two distinct -v flags +go test -v flag_test.go -args -v=7 # Two distinct -v flags + +-- flag_test.go -- package flag_test import ( diff --git a/src/cmd/go/testdata/script/test_minus_n.txt b/src/cmd/go/testdata/script/test_minus_n.txt new file mode 100644 index 00000000000..9900dbca0b8 --- /dev/null +++ b/src/cmd/go/testdata/script/test_minus_n.txt @@ -0,0 +1,14 @@ +# The intent here is to verify that 'go test -n' works without crashing. +# Any test will do. + +go test -n x_test.go + +-- x_test.go -- +package x_test + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +}