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
test:
gotest
+testshort:
+ gotest -test.short
+
bench:
gotest -test.bench=. -test.run="Do not run tests"
test:
gotest
+
+testshort:
+ gotest -test.short
test:
gotest
+
+testshort:
+ gotest -test.short
provided the test can run in the available memory without garbage
collection.
+The -test.short package tells long-running tests to shorten their
+run time. It is off by default but set by all.bash so installations
+of the Go tree can do a sanity check but not spend time running the
+full test suite.
*/
package documentation
test:
gotest
+
+testshort:
+ gotest -test.short
install.dirs: $(addsuffix .install, $(DIRS))
nuke.dirs: $(addsuffix .nuke, $(DIRS))
test.dirs: $(addsuffix .test, $(TEST))
+testshort.dirs: $(addsuffix .testshort, $(TEST))
bench.dirs: $(addsuffix .bench, $(BENCH))
%.clean:
%.test:
+$(MAKE) -C $* test
+%.testshort:
+ +$(MAKE) -C $* testshort
+
%.bench:
+$(MAKE) -C $* bench
test: test.dirs
+testshort: testshort.dirs
+
bench: bench.dirs ../../test/garbage.bench
nuke: nuke.dirs
func TestKeyGeneration(t *testing.T) {
testKeyGeneration(t, elliptic.P224(), "p224")
+ if testing.Short() {
+ return
+ }
testKeyGeneration(t, elliptic.P256(), "p256")
testKeyGeneration(t, elliptic.P384(), "p384")
testKeyGeneration(t, elliptic.P521(), "p521")
func TestSignAndVerify(t *testing.T) {
testSignAndVerify(t, elliptic.P224(), "p224")
+ if testing.Short() {
+ return
+ }
testSignAndVerify(t, elliptic.P256(), "p256")
testSignAndVerify(t, elliptic.P384(), "p384")
testSignAndVerify(t, elliptic.P521(), "p521")
if Verify(&pub, hashed, r, s) != test.ok {
t.Errorf("%d: bad result", i)
}
+ if testing.Short() {
+ break
+ }
}
}
)
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")
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 {
fi
(xcd pkg
-gomake test
+gomake testshort
) || exit $?
(xcd pkg/sync;
gomake clean;
time gomake
fi
-GOMAXPROCS=10 gomake test
+GOMAXPROCS=10 gomake testshort
) || exit $?
[ "$GOARCH" == arm ] ||