Commit 26222ddc authored by Russ Cox's avatar Russ Cox

cmd/go: skip long tests in -short mode

I marked every test that takes more than 0.5 seconds on my machine
as something to run only when not in -short mode, or in -short mode
on the beefy linux/amd64, windows/amd64, and darwin/amd64 builders.

I also shortened a few needlessly-expensive tests where possible.

Cuts the time for go test -short cmd/go from 45s to 15s on my machine.
Should help even more on some of our builders and slower user machines.

Fixes #23287.

Change-Id: I0e36003ef947b0ebe4224a1373731f9fa9216843
Reviewed-on: https://go-review.googlesource.com/86252
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent fcdcb194
...@@ -36,6 +36,16 @@ var ( ...@@ -36,6 +36,16 @@ var (
skipExternal = false // skip external tests skipExternal = false // skip external tests
) )
func tooSlow(t *testing.T) {
if testing.Short() {
// In -short mode; skip test, except run it on the {darwin,linux,windows}/amd64 builders.
if testenv.Builder() != "" && runtime.GOARCH == "amd64" && (runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "windows") {
return
}
t.Skip("skipping test in -short mode")
}
}
func init() { func init() {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "nacl": case "android", "nacl":
...@@ -907,6 +917,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) { ...@@ -907,6 +917,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
} }
func TestGoListStandard(t *testing.T) { func TestGoListStandard(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -932,6 +943,7 @@ func TestGoListStandard(t *testing.T) { ...@@ -932,6 +943,7 @@ func TestGoListStandard(t *testing.T) {
} }
func TestGoInstallCleansUpAfterGoBuild(t *testing.T) { func TestGoInstallCleansUpAfterGoBuild(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -974,6 +986,7 @@ func TestGoInstallCleansUpAfterGoBuild(t *testing.T) { ...@@ -974,6 +986,7 @@ func TestGoInstallCleansUpAfterGoBuild(t *testing.T) {
} }
func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) { func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1073,6 +1086,7 @@ func TestGoInstallErrorOnCrossCompileToBin(t *testing.T) { ...@@ -1073,6 +1086,7 @@ func TestGoInstallErrorOnCrossCompileToBin(t *testing.T) {
} }
func TestGoInstallDetectsRemovedFilesInPackageMain(t *testing.T) { func TestGoInstallDetectsRemovedFilesInPackageMain(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1574,6 +1588,7 @@ func TestBuildOutputToDevNull(t *testing.T) { ...@@ -1574,6 +1588,7 @@ func TestBuildOutputToDevNull(t *testing.T) {
} }
func TestPackageMainTestImportsArchiveNotBinary(t *testing.T) { func TestPackageMainTestImportsArchiveNotBinary(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1788,6 +1803,7 @@ func TestIgnoreEmptyPathsInGOPATH(t *testing.T) { ...@@ -1788,6 +1803,7 @@ func TestIgnoreEmptyPathsInGOPATH(t *testing.T) {
// Issue 4104. // Issue 4104.
func TestGoTestWithPackageListedMultipleTimes(t *testing.T) { func TestGoTestWithPackageListedMultipleTimes(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1798,6 +1814,7 @@ func TestGoTestWithPackageListedMultipleTimes(t *testing.T) { ...@@ -1798,6 +1814,7 @@ func TestGoTestWithPackageListedMultipleTimes(t *testing.T) {
} }
func TestGoListHasAConsistentOrder(t *testing.T) { func TestGoListHasAConsistentOrder(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1810,6 +1827,7 @@ func TestGoListHasAConsistentOrder(t *testing.T) { ...@@ -1810,6 +1827,7 @@ func TestGoListHasAConsistentOrder(t *testing.T) {
} }
func TestGoListStdDoesNotIncludeCommands(t *testing.T) { func TestGoListStdDoesNotIncludeCommands(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -1818,6 +1836,7 @@ func TestGoListStdDoesNotIncludeCommands(t *testing.T) { ...@@ -1818,6 +1836,7 @@ func TestGoListStdDoesNotIncludeCommands(t *testing.T) {
} }
func TestGoListCmdOnlyShowsCommands(t *testing.T) { func TestGoListCmdOnlyShowsCommands(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2036,6 +2055,7 @@ func TestGoGetIntoGOROOT(t *testing.T) { ...@@ -2036,6 +2055,7 @@ func TestGoGetIntoGOROOT(t *testing.T) {
} }
func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) { func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2049,6 +2069,7 @@ func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) { ...@@ -2049,6 +2069,7 @@ func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) {
} }
func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) { func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -2059,6 +2080,7 @@ func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) { ...@@ -2059,6 +2080,7 @@ func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) {
} }
func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) { func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -2069,6 +2091,7 @@ func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) { ...@@ -2069,6 +2091,7 @@ func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) {
} }
func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) { func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -2079,6 +2102,7 @@ func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) { ...@@ -2079,6 +2102,7 @@ func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) {
} }
func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) { func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -2099,6 +2123,7 @@ func TestGoBuildNonMain(t *testing.T) { ...@@ -2099,6 +2123,7 @@ func TestGoBuildNonMain(t *testing.T) {
} }
func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) { func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2108,6 +2133,7 @@ func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) { ...@@ -2108,6 +2133,7 @@ func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) {
} }
func TestGoTestDashOWritesBinary(t *testing.T) { func TestGoTestDashOWritesBinary(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2117,6 +2143,7 @@ func TestGoTestDashOWritesBinary(t *testing.T) { ...@@ -2117,6 +2143,7 @@ func TestGoTestDashOWritesBinary(t *testing.T) {
} }
func TestGoTestDashIDashOWritesBinary(t *testing.T) { func TestGoTestDashIDashOWritesBinary(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2214,6 +2241,7 @@ func TestSymlinksInternal(t *testing.T) { ...@@ -2214,6 +2241,7 @@ func TestSymlinksInternal(t *testing.T) {
// Issue 4515. // Issue 4515.
func TestInstallWithTags(t *testing.T) { func TestInstallWithTags(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2398,9 +2426,7 @@ func checkCoverage(tg *testgoData, data string) { ...@@ -2398,9 +2426,7 @@ func checkCoverage(tg *testgoData, data string) {
} }
func TestCoverageRuns(t *testing.T) { func TestCoverageRuns(t *testing.T) {
if testing.Short() { tooSlow(t)
t.Skip("don't build libraries for coverage in short mode")
}
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.run("test", "-short", "-coverpkg=strings", "strings", "regexp") tg.run("test", "-short", "-coverpkg=strings", "strings", "regexp")
...@@ -2413,9 +2439,7 @@ func TestCoverageRuns(t *testing.T) { ...@@ -2413,9 +2439,7 @@ func TestCoverageRuns(t *testing.T) {
// Check that coverage analysis uses set mode. // Check that coverage analysis uses set mode.
// Also check that coverage profiles merge correctly. // Also check that coverage profiles merge correctly.
func TestCoverageUsesSetMode(t *testing.T) { func TestCoverageUsesSetMode(t *testing.T) {
if testing.Short() { tooSlow(t)
t.Skip("don't build libraries for coverage in short mode")
}
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.creatingTemp("testdata/cover.out") tg.creatingTemp("testdata/cover.out")
...@@ -2441,9 +2465,7 @@ func TestCoverageUsesSetMode(t *testing.T) { ...@@ -2441,9 +2465,7 @@ func TestCoverageUsesSetMode(t *testing.T) {
} }
func TestCoverageUsesAtomicModeForRace(t *testing.T) { func TestCoverageUsesAtomicModeForRace(t *testing.T) {
if testing.Short() { tooSlow(t)
t.Skip("don't build libraries for coverage in short mode")
}
if !canRace { if !canRace {
t.Skip("skipping because race detector not supported") t.Skip("skipping because race detector not supported")
} }
...@@ -2464,6 +2486,7 @@ func TestCoverageUsesAtomicModeForRace(t *testing.T) { ...@@ -2464,6 +2486,7 @@ func TestCoverageUsesAtomicModeForRace(t *testing.T) {
} }
func TestCoverageSyncAtomicImport(t *testing.T) { func TestCoverageSyncAtomicImport(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2472,6 +2495,7 @@ func TestCoverageSyncAtomicImport(t *testing.T) { ...@@ -2472,6 +2495,7 @@ func TestCoverageSyncAtomicImport(t *testing.T) {
} }
func TestCoverageDepLoop(t *testing.T) { func TestCoverageDepLoop(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2493,6 +2517,7 @@ func TestCoverageImportMainLoop(t *testing.T) { ...@@ -2493,6 +2517,7 @@ func TestCoverageImportMainLoop(t *testing.T) {
} }
func TestCoveragePattern(t *testing.T) { func TestCoveragePattern(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2507,6 +2532,7 @@ func TestCoveragePattern(t *testing.T) { ...@@ -2507,6 +2532,7 @@ func TestCoveragePattern(t *testing.T) {
} }
func TestCoverageErrorLine(t *testing.T) { func TestCoverageErrorLine(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2536,6 +2562,8 @@ func TestCoverageErrorLine(t *testing.T) { ...@@ -2536,6 +2562,8 @@ func TestCoverageErrorLine(t *testing.T) {
} }
func TestTestBuildFailureOutput(t *testing.T) { func TestTestBuildFailureOutput(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2547,6 +2575,7 @@ func TestTestBuildFailureOutput(t *testing.T) { ...@@ -2547,6 +2575,7 @@ func TestTestBuildFailureOutput(t *testing.T) {
} }
func TestCoverageFunc(t *testing.T) { func TestCoverageFunc(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -2621,9 +2650,7 @@ func TestTestRaceInstall(t *testing.T) { ...@@ -2621,9 +2650,7 @@ func TestTestRaceInstall(t *testing.T) {
if !canRace { if !canRace {
t.Skip("no race detector") t.Skip("no race detector")
} }
if testing.Short() && testenv.Builder() == "" { tooSlow(t)
t.Skip("don't rebuild the standard library in short mode")
}
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
...@@ -2660,6 +2687,7 @@ func main() { ...@@ -2660,6 +2687,7 @@ func main() {
} }
func TestCoverageWithCgo(t *testing.T) { func TestCoverageWithCgo(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -2734,6 +2762,7 @@ func TestCgoShowsFullPathNames(t *testing.T) { ...@@ -2734,6 +2762,7 @@ func TestCgoShowsFullPathNames(t *testing.T) {
} }
func TestCgoHandlesWlORIGIN(t *testing.T) { func TestCgoHandlesWlORIGIN(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -2751,6 +2780,7 @@ func TestCgoHandlesWlORIGIN(t *testing.T) { ...@@ -2751,6 +2780,7 @@ func TestCgoHandlesWlORIGIN(t *testing.T) {
} }
func TestCgoPkgConfig(t *testing.T) { func TestCgoPkgConfig(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -2801,6 +2831,7 @@ func main() { ...@@ -2801,6 +2831,7 @@ func main() {
// "go test -c" should also appear to write a new binary every time, // "go test -c" should also appear to write a new binary every time,
// even if it's really just updating the mtime on an existing up-to-date binary. // even if it's really just updating the mtime on an existing up-to-date binary.
func TestIssue6480(t *testing.T) { func TestIssue6480(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
// TODO: tg.parallel() // TODO: tg.parallel()
...@@ -2936,6 +2967,8 @@ func TestIssue6844(t *testing.T) { ...@@ -2936,6 +2967,8 @@ func TestIssue6844(t *testing.T) {
} }
func TestBuildDashIInstallsDependencies(t *testing.T) { func TestBuildDashIInstallsDependencies(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -3019,6 +3052,7 @@ func TestGoTestMainTwice(t *testing.T) { ...@@ -3019,6 +3052,7 @@ func TestGoTestMainTwice(t *testing.T) {
} }
func TestGoTestFlagsAfterPackage(t *testing.T) { func TestGoTestFlagsAfterPackage(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.run("test", "testdata/flag_test.go", "-v", "-args", "-v=7") // Two distinct -v flags. tg.run("test", "testdata/flag_test.go", "-v", "-args", "-v=7") // Two distinct -v flags.
...@@ -3202,6 +3236,8 @@ func TestGoGetHTTPS404(t *testing.T) { ...@@ -3202,6 +3236,8 @@ func TestGoGetHTTPS404(t *testing.T) {
// Test that you cannot import a main package. // Test that you cannot import a main package.
// See golang.org/issue/4210 and golang.org/issue/17475. // See golang.org/issue/4210 and golang.org/issue/17475.
func TestImportMain(t *testing.T) { func TestImportMain(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
tg.parallel() tg.parallel()
defer tg.cleanup() defer tg.cleanup()
...@@ -3290,6 +3326,8 @@ func TestImportMain(t *testing.T) { ...@@ -3290,6 +3326,8 @@ func TestImportMain(t *testing.T) {
// accessed by a non-local import (found in a GOPATH/GOROOT). // accessed by a non-local import (found in a GOPATH/GOROOT).
// See golang.org/issue/17475. // See golang.org/issue/17475.
func TestImportLocal(t *testing.T) { func TestImportLocal(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
tg.parallel() tg.parallel()
defer tg.cleanup() defer tg.cleanup()
...@@ -3507,6 +3545,8 @@ func TestGoRunDirs(t *testing.T) { ...@@ -3507,6 +3545,8 @@ func TestGoRunDirs(t *testing.T) {
} }
func TestGoInstallPkgdir(t *testing.T) { func TestGoInstallPkgdir(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
tg.parallel() tg.parallel()
defer tg.cleanup() defer tg.cleanup()
...@@ -3542,6 +3582,8 @@ func TestGoTestRaceInstallCgo(t *testing.T) { ...@@ -3542,6 +3582,8 @@ func TestGoTestRaceInstallCgo(t *testing.T) {
} }
func TestGoTestRaceFailures(t *testing.T) { func TestGoTestRaceFailures(t *testing.T) {
tooSlow(t)
if !canRace { if !canRace {
t.Skip("skipping because race detector not supported") t.Skip("skipping because race detector not supported")
} }
...@@ -3750,6 +3792,7 @@ func TestIssue12096(t *testing.T) { ...@@ -3750,6 +3792,7 @@ func TestIssue12096(t *testing.T) {
} }
func TestGoBuildOutput(t *testing.T) { func TestGoBuildOutput(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
...@@ -3830,6 +3873,7 @@ func TestGoBuildARM(t *testing.T) { ...@@ -3830,6 +3873,7 @@ func TestGoBuildARM(t *testing.T) {
// For issue 14337. // For issue 14337.
func TestParallelTest(t *testing.T) { func TestParallelTest(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
tg.parallel() tg.parallel()
defer tg.cleanup() defer tg.cleanup()
...@@ -3849,6 +3893,7 @@ func TestParallelTest(t *testing.T) { ...@@ -3849,6 +3893,7 @@ func TestParallelTest(t *testing.T) {
} }
func TestCgoConsistentResults(t *testing.T) { func TestCgoConsistentResults(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -3915,6 +3960,8 @@ func TestFatalInBenchmarkCauseNonZeroExitStatus(t *testing.T) { ...@@ -3915,6 +3960,8 @@ func TestFatalInBenchmarkCauseNonZeroExitStatus(t *testing.T) {
} }
func TestBinaryOnlyPackages(t *testing.T) { func TestBinaryOnlyPackages(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -4225,6 +4272,7 @@ func TestMatchesOnlySubtestParallelIsOK(t *testing.T) { ...@@ -4225,6 +4272,7 @@ func TestMatchesOnlySubtestParallelIsOK(t *testing.T) {
// Issue 18845 // Issue 18845
func TestBenchTimeout(t *testing.T) { func TestBenchTimeout(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.run("test", "-bench", ".", "-timeout", "750ms", "testdata/timeoutbench_test.go") tg.run("test", "-bench", ".", "-timeout", "750ms", "testdata/timeoutbench_test.go")
...@@ -4232,6 +4280,7 @@ func TestBenchTimeout(t *testing.T) { ...@@ -4232,6 +4280,7 @@ func TestBenchTimeout(t *testing.T) {
// Issue 19394 // Issue 19394
func TestWriteProfilesOnTimeout(t *testing.T) { func TestWriteProfilesOnTimeout(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.tempDir("profiling") tg.tempDir("profiling")
...@@ -4344,6 +4393,7 @@ func TestFFLAGS(t *testing.T) { ...@@ -4344,6 +4393,7 @@ func TestFFLAGS(t *testing.T) {
// Issue 19198. // Issue 19198.
// This is really a cmd/link issue but this is a convenient place to test it. // This is really a cmd/link issue but this is a convenient place to test it.
func TestDuplicateGlobalAsmSymbols(t *testing.T) { func TestDuplicateGlobalAsmSymbols(t *testing.T) {
tooSlow(t)
if runtime.GOARCH != "386" && runtime.GOARCH != "amd64" { if runtime.GOARCH != "386" && runtime.GOARCH != "amd64" {
t.Skipf("skipping test on %s", runtime.GOARCH) t.Skipf("skipping test on %s", runtime.GOARCH)
} }
...@@ -4574,6 +4624,7 @@ func main() {}`) ...@@ -4574,6 +4624,7 @@ func main() {}`)
} }
func TestCgoFlagContainsSpace(t *testing.T) { func TestCgoFlagContainsSpace(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -4597,6 +4648,7 @@ func TestCgoFlagContainsSpace(t *testing.T) { ...@@ -4597,6 +4648,7 @@ func TestCgoFlagContainsSpace(t *testing.T) {
// Issue #20435. // Issue #20435.
func TestGoTestRaceCoverModeFailures(t *testing.T) { func TestGoTestRaceCoverModeFailures(t *testing.T) {
tooSlow(t)
if !canRace { if !canRace {
t.Skip("skipping because race detector not supported") t.Skip("skipping because race detector not supported")
} }
...@@ -4711,6 +4763,7 @@ func TestTestRegexps(t *testing.T) { ...@@ -4711,6 +4763,7 @@ func TestTestRegexps(t *testing.T) {
} }
func TestListTests(t *testing.T) { func TestListTests(t *testing.T) {
tooSlow(t)
var tg *testgoData var tg *testgoData
testWith := func(listName, expected string) func(*testing.T) { testWith := func(listName, expected string) func(*testing.T) {
return func(t *testing.T) { return func(t *testing.T) {
...@@ -4728,6 +4781,9 @@ func TestListTests(t *testing.T) { ...@@ -4728,6 +4781,9 @@ func TestListTests(t *testing.T) {
} }
func TestBuildmodePIE(t *testing.T) { func TestBuildmodePIE(t *testing.T) {
if testing.Short() && testenv.Builder() == "" {
t.Skipf("skipping in -short mode on non-builder")
}
if runtime.Compiler == "gccgo" { if runtime.Compiler == "gccgo" {
t.Skipf("skipping test because buildmode=pie is not supported on gccgo") t.Skipf("skipping test because buildmode=pie is not supported on gccgo")
} }
...@@ -4786,6 +4842,7 @@ func TestBuildmodePIE(t *testing.T) { ...@@ -4786,6 +4842,7 @@ func TestBuildmodePIE(t *testing.T) {
} }
func TestExecBuildX(t *testing.T) { func TestExecBuildX(t *testing.T) {
tooSlow(t)
if !canCgo { if !canCgo {
t.Skip("skipping because cgo not enabled") t.Skip("skipping because cgo not enabled")
} }
...@@ -4838,6 +4895,7 @@ func TestExecBuildX(t *testing.T) { ...@@ -4838,6 +4895,7 @@ func TestExecBuildX(t *testing.T) {
} }
func TestParallelNumber(t *testing.T) { func TestParallelNumber(t *testing.T) {
tooSlow(t)
for _, n := range [...]string{"-1", "0"} { for _, n := range [...]string{"-1", "0"} {
t.Run(n, func(t *testing.T) { t.Run(n, func(t *testing.T) {
tg := testgo(t) tg := testgo(t)
...@@ -4926,6 +4984,7 @@ func TestGOTMPDIR(t *testing.T) { ...@@ -4926,6 +4984,7 @@ func TestGOTMPDIR(t *testing.T) {
} }
func TestBuildCache(t *testing.T) { func TestBuildCache(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -4986,6 +5045,8 @@ func TestCacheOutput(t *testing.T) { ...@@ -4986,6 +5045,8 @@ func TestCacheOutput(t *testing.T) {
} }
func TestCacheCoverage(t *testing.T) { func TestCacheCoverage(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -4997,8 +5058,8 @@ func TestCacheCoverage(t *testing.T) { ...@@ -4997,8 +5058,8 @@ func TestCacheCoverage(t *testing.T) {
tg.makeTempdir() tg.makeTempdir()
tg.setenv("GOCACHE", tg.path("c1")) tg.setenv("GOCACHE", tg.path("c1"))
tg.run("test", "-cover", "strings") tg.run("test", "-cover", "-short", "strings")
tg.run("test", "-cover", "math", "strings") tg.run("test", "-cover", "-short", "math", "strings")
} }
func TestIssue22588(t *testing.T) { func TestIssue22588(t *testing.T) {
...@@ -5017,6 +5078,7 @@ func TestIssue22588(t *testing.T) { ...@@ -5017,6 +5078,7 @@ func TestIssue22588(t *testing.T) {
} }
func TestIssue22531(t *testing.T) { func TestIssue22531(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -5045,6 +5107,7 @@ func TestIssue22531(t *testing.T) { ...@@ -5045,6 +5107,7 @@ func TestIssue22531(t *testing.T) {
} }
func TestIssue22596(t *testing.T) { func TestIssue22596(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -5073,6 +5136,8 @@ func TestIssue22596(t *testing.T) { ...@@ -5073,6 +5136,8 @@ func TestIssue22596(t *testing.T) {
} }
func TestTestCache(t *testing.T) { func TestTestCache(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -5177,6 +5242,8 @@ func TestTestCache(t *testing.T) { ...@@ -5177,6 +5242,8 @@ func TestTestCache(t *testing.T) {
} }
func TestTestCacheInputs(t *testing.T) { func TestTestCacheInputs(t *testing.T) {
tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify") t.Skip("GODEBUG gocacheverify")
} }
...@@ -5267,6 +5334,7 @@ func TestTestCacheInputs(t *testing.T) { ...@@ -5267,6 +5334,7 @@ func TestTestCacheInputs(t *testing.T) {
} }
func TestTestVet(t *testing.T) { func TestTestVet(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -5308,6 +5376,7 @@ func TestTestVet(t *testing.T) { ...@@ -5308,6 +5376,7 @@ func TestTestVet(t *testing.T) {
} }
func TestInstallDeps(t *testing.T) { func TestInstallDeps(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -5355,6 +5424,7 @@ func TestFmtLoadErrors(t *testing.T) { ...@@ -5355,6 +5424,7 @@ func TestFmtLoadErrors(t *testing.T) {
} }
func TestRelativePkgdir(t *testing.T) { func TestRelativePkgdir(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.makeTempdir() tg.makeTempdir()
...@@ -5370,18 +5440,18 @@ func TestGcflagsPatterns(t *testing.T) { ...@@ -5370,18 +5440,18 @@ func TestGcflagsPatterns(t *testing.T) {
tg.setenv("GOPATH", "") tg.setenv("GOPATH", "")
tg.setenv("GOCACHE", "off") tg.setenv("GOCACHE", "off")
tg.run("build", "-v", "-gcflags= \t\r\n -e", "fmt") tg.run("build", "-n", "-v", "-gcflags= \t\r\n -e", "fmt")
tg.grepStderr("fmt", "did not rebuild fmt") tg.grepStderr("^# fmt", "did not rebuild fmt")
tg.grepStderrNot("reflect", "incorrectly rebuilt reflect") tg.grepStderrNot("^# reflect", "incorrectly rebuilt reflect")
tg.run("build", "-v", "-gcflags=-e", "fmt", "reflect") tg.run("build", "-n", "-v", "-gcflags=-e", "fmt", "reflect")
tg.grepStderr("fmt", "did not rebuild fmt") tg.grepStderr("^# fmt", "did not rebuild fmt")
tg.grepStderr("reflect", "did not rebuild reflect") tg.grepStderr("^# reflect", "did not rebuild reflect")
tg.grepStderrNot("runtime", "incorrectly rebuilt runtime") tg.grepStderrNot("^# runtime", "incorrectly rebuilt runtime")
tg.run("build", "-x", "-v", "-gcflags= \t\r\n reflect \t\r\n = \t\r\n -N", "fmt") tg.run("build", "-n", "-x", "-v", "-gcflags= \t\r\n reflect \t\r\n = \t\r\n -N", "fmt")
tg.grepStderr("fmt", "did not rebuild fmt") tg.grepStderr("^# fmt", "did not rebuild fmt")
tg.grepStderr("reflect", "did not rebuild reflect") tg.grepStderr("^# reflect", "did not rebuild reflect")
tg.grepStderr("compile.* -N .*-p reflect", "did not build reflect with -N flag") tg.grepStderr("compile.* -N .*-p reflect", "did not build reflect with -N flag")
tg.grepStderrNot("compile.* -N .*-p fmt", "incorrectly built fmt with -N flag") tg.grepStderrNot("compile.* -N .*-p fmt", "incorrectly built fmt with -N flag")
...@@ -5403,6 +5473,8 @@ func TestGoTestMinusN(t *testing.T) { ...@@ -5403,6 +5473,8 @@ func TestGoTestMinusN(t *testing.T) {
} }
func TestGoTestJSON(t *testing.T) { func TestGoTestJSON(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
...@@ -5438,6 +5510,7 @@ func TestGoTestJSON(t *testing.T) { ...@@ -5438,6 +5510,7 @@ func TestGoTestJSON(t *testing.T) {
} }
func TestFailFast(t *testing.T) { func TestFailFast(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
...@@ -5483,6 +5556,7 @@ func TestFailFast(t *testing.T) { ...@@ -5483,6 +5556,7 @@ func TestFailFast(t *testing.T) {
// Issue 22986. // Issue 22986.
func TestImportPath(t *testing.T) { func TestImportPath(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.parallel() tg.parallel()
......
...@@ -148,6 +148,7 @@ func splitLines(s string) []string { ...@@ -148,6 +148,7 @@ func splitLines(s string) []string {
} }
func TestVendorGet(t *testing.T) { func TestVendorGet(t *testing.T) {
tooSlow(t)
tg := testgo(t) tg := testgo(t)
defer tg.cleanup() defer tg.cleanup()
tg.tempFile("src/v/m.go", ` tg.tempFile("src/v/m.go", `
...@@ -173,8 +174,8 @@ func TestVendorGet(t *testing.T) { ...@@ -173,8 +174,8 @@ func TestVendorGet(t *testing.T) {
tg.grepStdout("v/vendor/vendor.org/p", "import not in vendor directory") tg.grepStdout("v/vendor/vendor.org/p", "import not in vendor directory")
tg.run("list", "-f", "{{.TestImports}}") tg.run("list", "-f", "{{.TestImports}}")
tg.grepStdout("v/vendor/vendor.org/p", "test import not in vendor directory") tg.grepStdout("v/vendor/vendor.org/p", "test import not in vendor directory")
tg.run("get") tg.run("get", "-d")
tg.run("get", "-t") tg.run("get", "-t", "-d")
} }
func TestVendorGetUpdate(t *testing.T) { func TestVendorGetUpdate(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment