testing: set up structure for faster testing using the new -test.short flag.

New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.

Once this is in, I will update the long-running tests to use the new flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4317043
This commit is contained in:
Rob Pike 2011-03-25 14:50:44 -07:00
parent 47c1cef56b
commit d406f8f650
9 changed files with 45 additions and 2 deletions

View file

@ -48,6 +48,13 @@ import (
)
var (
// The short flag requests that tests run more quickly, but its functionality
// is provided by test writers themselves. The testing package is just its
// home. The all.bash installation script sets it to make installation more
// efficient, but by default the flag is off so a plain "gotest" will do a
// full test of the package.
short = flag.Bool("test.short", false, "run smaller test suite to save time")
// Report as tests are run; default is silent for success.
chatty = flag.Bool("test.v", false, "verbose: print additional output")
match = flag.String("test.run", "", "regular expression to select tests to run")
@ -56,6 +63,11 @@ var (
cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution")
)
// Short reports whether the -test.short flag is set.
func Short() bool {
return *short
}
// Insert final newline if needed and tabs after internal newlines.
func tabify(s string) string {