This cuts 23 seconds from all.bash on my MacBook Pro.
Change-Id: Ibc4d7c01660b9e9ebd088dd55ba993f0d7ec6aa3
Reviewed-on: https://go-review.googlesource.com/73991
Reviewed-by: Ian Lance Taylor <iant@golang.org>
testName := "runtime:cpu124"
t.tests = append(t.tests, distTest{
name: testName,
- heading: "GOMAXPROCS=2 runtime -cpu=1,2,4",
+ heading: "GOMAXPROCS=2 runtime -cpu=1,2,4 -quick",
fn: func(dt *distTest) error {
- cmd := t.addCmd(dt, "src", "go", "test", "-short", t.timeout(300), t.tags(), "runtime", "-cpu=1,2,4")
+ cmd := t.addCmd(dt, "src", "go", "test", "-short", t.timeout(300), t.tags(), "runtime", "-cpu=1,2,4", "-quick")
// We set GOMAXPROCS=2 in addition to -cpu=1,2,4 in order to test runtime bootstrap code,
// creation of first goroutines and first garbage collections in the parallel setting.
cmd.Env = append(os.Environ(), "GOMAXPROCS=2")
}
func runTestProg(t *testing.T, binary, name string, env ...string) string {
+ if *flagQuick {
+ t.Skip("-quick")
+ }
+
testenv.MustHaveGoBuild(t)
exe, err := buildTestProg(t, binary)
cmd := testenv.CleanCmdEnv(exec.Command(exe, name))
cmd.Env = append(cmd.Env, env...)
+ if testing.Short() {
+ cmd.Env = append(cmd.Env, "RUNTIME_TEST_SHORT=1")
+ }
var b bytes.Buffer
cmd.Stdout = &b
cmd.Stderr = &b
}
func buildTestProg(t *testing.T, binary string, flags ...string) (string, error) {
+ if *flagQuick {
+ t.Skip("-quick")
+ }
+
checkStaleRuntime(t)
testprog.Lock()
numGrowStep := 250
numReader := 16
if testing.Short() {
- numLoop, numGrowStep = 2, 500
+ numLoop, numGrowStep = 2, 100
}
for i := 0; i < numLoop; i++ {
m := make(map[int]int, 0)
"encoding/binary"
"fmt"
"internal/race"
+ "internal/testenv"
. "runtime"
"testing"
)
}
func TestMemmoveLarge0x180000(t *testing.T) {
+ if testing.Short() && testenv.Builder() == "" {
+ t.Skip("-short")
+ }
+
t.Parallel()
if race.Enabled {
t.Skip("skipping large memmove test under race detector")
}
func TestMemmoveOverlapLarge0x120000(t *testing.T) {
+ if testing.Short() && testenv.Builder() == "" {
+ t.Skip("-short")
+ }
+
t.Parallel()
if race.Enabled {
t.Skip("skipping large memmove test under race detector")
)
func TestDeferKeepAlive(t *testing.T) {
+ if *flagQuick {
+ t.Skip("-quick")
+ }
+
// See issue 21402.
t.Parallel()
type T *int // needs to be a pointer base type to avoid tinyalloc and its never-finalized behavior.
package runtime_test
import (
+ "flag"
"io"
. "runtime"
"runtime/debug"
"unsafe"
)
+var flagQuick = flag.Bool("quick", false, "skip slow tests, for second run in all.bash")
+
func init() {
// We're testing the runtime, so make tracebacks show things
// in the runtime. This only raises the level, so it won't
import (
"fmt"
+ "os"
"runtime"
)
}
func CgoCallbackGC() {
- const P = 100
+ P := 100
+ if os.Getenv("RUNTIME_TESTING_SHORT") != "" {
+ P = 10
+ }
done := make(chan bool)
// allocate a bunch of stack frames and spray them with pointers
for i := 0; i < P; i++ {
time.Sleep(time.Millisecond)
start := time.Now()
var times []time.Duration
- for i := 0; i < 64; i++ {
+ n := 64
+ if os.Getenv("RUNTIME_TEST_SHORT") != "" {
+ n = 16
+ }
+ for i := 0; i < n; i++ {
go func() {
runtime.LockOSThread()
select {}