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() {
switch runtime.GOOS {
case "android", "nacl":
}
func TestGoListStandard(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoInstallCleansUpAfterGoBuild(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoInstallDetectsRemovedFilesInPackageMain(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestPackageMainTestImportsArchiveNotBinary(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
// Issue 4104.
func TestGoTestWithPackageListedMultipleTimes(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoListHasAConsistentOrder(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoListStdDoesNotIncludeCommands(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoListCmdOnlyShowsCommands(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoTestDashOWritesBinary(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestGoTestDashIDashOWritesBinary(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
// Issue 4515.
func TestInstallWithTags(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestCoverageRuns(t *testing.T) {
- if testing.Short() {
- t.Skip("don't build libraries for coverage in short mode")
- }
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.run("test", "-short", "-coverpkg=strings", "strings", "regexp")
// Check that coverage analysis uses set mode.
// Also check that coverage profiles merge correctly.
func TestCoverageUsesSetMode(t *testing.T) {
- if testing.Short() {
- t.Skip("don't build libraries for coverage in short mode")
- }
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.creatingTemp("testdata/cover.out")
}
func TestCoverageUsesAtomicModeForRace(t *testing.T) {
- if testing.Short() {
- t.Skip("don't build libraries for coverage in short mode")
- }
+ tooSlow(t)
if !canRace {
t.Skip("skipping because race detector not supported")
}
}
func TestCoverageSyncAtomicImport(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestCoverageDepLoop(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestCoveragePattern(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestCoverageErrorLine(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestTestBuildFailureOutput(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestCoverageFunc(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
if !canRace {
t.Skip("no race detector")
}
- if testing.Short() && testenv.Builder() == "" {
- t.Skip("don't rebuild the standard library in short mode")
- }
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
}
func TestCoverageWithCgo(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
}
func TestCgoHandlesWlORIGIN(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
}
func TestCgoPkgConfig(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
// "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.
func TestIssue6480(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// TODO: tg.parallel()
}
func TestBuildDashIInstallsDependencies(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
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.
// Test that you cannot import a main package.
// See golang.org/issue/4210 and golang.org/issue/17475.
func TestImportMain(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
tg.parallel()
defer tg.cleanup()
// accessed by a non-local import (found in a GOPATH/GOROOT).
// See golang.org/issue/17475.
func TestImportLocal(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
tg.parallel()
defer tg.cleanup()
}
func TestGoInstallPkgdir(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
tg.parallel()
defer tg.cleanup()
}
func TestGoTestRaceFailures(t *testing.T) {
+ tooSlow(t)
+
if !canRace {
t.Skip("skipping because race detector not supported")
}
}
func TestGoBuildOutput(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// For issue 14337.
func TestParallelTest(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
tg.parallel()
defer tg.cleanup()
}
func TestCgoConsistentResults(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
}
func TestBinaryOnlyPackages(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
// Issue 18845
func TestBenchTimeout(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.run("test", "-bench", ".", "-timeout", "750ms", "testdata/timeoutbench_test.go")
// Issue 19394
func TestWriteProfilesOnTimeout(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.tempDir("profiling")
// Issue 19198.
// This is really a cmd/link issue but this is a convenient place to test it.
func TestDuplicateGlobalAsmSymbols(t *testing.T) {
+ tooSlow(t)
if runtime.GOARCH != "386" && runtime.GOARCH != "amd64" {
t.Skipf("skipping test on %s", runtime.GOARCH)
}
}
func TestCgoFlagContainsSpace(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
// Issue #20435.
func TestGoTestRaceCoverModeFailures(t *testing.T) {
+ tooSlow(t)
if !canRace {
t.Skip("skipping because race detector not supported")
}
}
func TestListTests(t *testing.T) {
+ tooSlow(t)
var tg *testgoData
testWith := func(listName, expected string) func(*testing.T) {
return func(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" {
t.Skipf("skipping test because buildmode=pie is not supported on gccgo")
}
}
func TestExecBuildX(t *testing.T) {
+ tooSlow(t)
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
}
func TestParallelNumber(t *testing.T) {
+ tooSlow(t)
for _, n := range [...]string{"-1", "0"} {
t.Run(n, func(t *testing.T) {
tg := testgo(t)
}
func TestBuildCache(t *testing.T) {
+ tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
}
func TestCacheCoverage(t *testing.T) {
+ tooSlow(t)
+
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
tg.makeTempdir()
tg.setenv("GOCACHE", tg.path("c1"))
- tg.run("test", "-cover", "strings")
- tg.run("test", "-cover", "math", "strings")
+ tg.run("test", "-cover", "-short", "strings")
+ tg.run("test", "-cover", "-short", "math", "strings")
}
func TestIssue22588(t *testing.T) {
}
func TestIssue22531(t *testing.T) {
+ tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
}
func TestIssue22596(t *testing.T) {
+ tooSlow(t)
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
}
func TestTestCache(t *testing.T) {
+ tooSlow(t)
+
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
}
func TestTestCacheInputs(t *testing.T) {
+ tooSlow(t)
+
if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
t.Skip("GODEBUG gocacheverify")
}
}
func TestTestVet(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestInstallDeps(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestRelativePkgdir(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.makeTempdir()
tg.setenv("GOPATH", "")
tg.setenv("GOCACHE", "off")
- tg.run("build", "-v", "-gcflags= \t\r\n -e", "fmt")
- tg.grepStderr("fmt", "did not rebuild fmt")
- tg.grepStderrNot("reflect", "incorrectly rebuilt reflect")
+ tg.run("build", "-n", "-v", "-gcflags= \t\r\n -e", "fmt")
+ tg.grepStderr("^# fmt", "did not rebuild fmt")
+ tg.grepStderrNot("^# reflect", "incorrectly rebuilt reflect")
- tg.run("build", "-v", "-gcflags=-e", "fmt", "reflect")
- tg.grepStderr("fmt", "did not rebuild fmt")
- tg.grepStderr("reflect", "did not rebuild reflect")
- tg.grepStderrNot("runtime", "incorrectly rebuilt runtime")
+ tg.run("build", "-n", "-v", "-gcflags=-e", "fmt", "reflect")
+ tg.grepStderr("^# fmt", "did not rebuild fmt")
+ tg.grepStderr("^# reflect", "did not rebuild reflect")
+ 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.grepStderr("fmt", "did not rebuild fmt")
- tg.grepStderr("reflect", "did not rebuild reflect")
+ 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("^# reflect", "did not rebuild reflect")
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")
}
func TestGoTestJSON(t *testing.T) {
+ tooSlow(t)
+
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
}
func TestFailFast(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
// Issue 22986.
func TestImportPath(t *testing.T) {
+ tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()