1
0
mirror of https://github.com/golang/go synced 2024-10-04 20:21:22 -06:00
go/src/pkg/testing
Russ Cox ccc4553491 cmd/go, testing: streamline direct use of test binaries
Before:

        $ go test -c -cover fmt
        $ ./fmt.test -test.covermode=set
        PASS
        coverage: 65.1% of statements in strconv
        $

After:

        $ go test -c -cover fmt
        $ ./fmt.test
        PASS
        coverage: 65.1% of statements in strconv
        $

In addition to being cumbersome, the old flag didn't make sense:
the cover mode cannot be changed after the binary has been built.

Another useful effect of this CL is that if you happen to do

        $ go test -c -covermode=atomic fmt

and then forget you did that and run benchmarks,
the final line of the output (the coverage summary) reminds you
that you are benchmarking with coverage enabled, which might
not be what you want.

        $ ./fmt.test -test.bench .
        PASS
        BenchmarkSprintfEmpty	10000000	       217 ns/op
        BenchmarkSprintfString	 2000000	       755 ns/op
        BenchmarkSprintfInt	 2000000	       774 ns/op
        BenchmarkSprintfIntInt	 1000000	      1363 ns/op
        BenchmarkSprintfPrefixedInt	 1000000	      1501 ns/op
        BenchmarkSprintfFloat	 1000000	      1257 ns/op
        BenchmarkManyArgs	  500000	      5346 ns/op
        BenchmarkScanInts	    1000	   2562402 ns/op
        BenchmarkScanRecursiveInt	     500	   3189457 ns/op
        coverage: 91.4% of statements
        $

As part of passing the new mode setting in via _testmain.go, merge
the two registration mechanisms into one extensible mechanism
(a struct).

R=r
CC=golang-dev
https://golang.org/cl/11219043
2013-07-12 20:40:30 -04:00
..
iotest testing/iotest: rephrase DataErrReader's description 2013-04-12 16:08:56 -07:00
quick testing/quick: fix for aliased types, delete duplicate uint8 test, and fix randFloat64() to give random numbers from (-math.MaxFloat64, math.MaxFloat64). 2013-05-14 17:14:59 -07:00
allocs.go testing: quantize AllocsPerRun 2013-05-30 11:28:08 -04:00
benchmark_test.go testing: fix rounding error in roundDown10 2013-06-02 09:13:12 +10:00
benchmark.go testing: fix rounding error in roundDown10 2013-06-02 09:13:12 +10:00
cover.go cmd/go, testing: streamline direct use of test binaries 2013-07-12 20:40:30 -04:00
example.go testing: allow examples to pass (fix build) 2013-01-18 12:25:41 +11:00
export_test.go testing: fix rounding error in roundDown10 2013-06-02 09:13:12 +10:00
testing.go cmd/go, testing: streamline direct use of test binaries 2013-07-12 20:40:30 -04:00