1
0
mirror of https://github.com/golang/go synced 2024-10-03 03:11:21 -06:00
Commit Graph

118 Commits

Author SHA1 Message Date
Russ Cox
fddc3ca11c testing: add -test.count flag to run tests and benchmarks multiple times
The flag is available from the go test command as -count:

% go test -run XXX -bench . -count 3
PASS
BenchmarkSprintfEmpty      	30000000	        54.0 ns/op
BenchmarkSprintfEmpty      	30000000	        51.9 ns/op
BenchmarkSprintfEmpty      	30000000	        53.8 ns/op
BenchmarkSprintfString     	10000000	       238 ns/op
BenchmarkSprintfString     	10000000	       239 ns/op
BenchmarkSprintfString     	10000000	       234 ns/op
BenchmarkSprintfInt        	10000000	       232 ns/op
BenchmarkSprintfInt        	10000000	       226 ns/op
BenchmarkSprintfInt        	10000000	       225 ns/op
...

If -cpu is set, each test is run n times for each cpu value.

Original by r (CL 10663).

Change-Id: If3dfbdf21698952daac9249b5dbca66f5301e91b
Reviewed-on: https://go-review.googlesource.com/10669
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-05 04:31:10 +00:00
Shenghou Ma
c06b856555 testing: fix typo
Fixes #10794.

Change-Id: Id91485394ddbadc28c800e1d0c3ec281ba6cd098
Reviewed-on: https://go-review.googlesource.com/9990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-12 23:39:00 +00:00
Rob Pike
2b833666f1 testing: make the output of -v more uniform and aligned when using fixed-width fonts
Delete the colon from RUN: for examples, since it's not there for tests.
Add spaces to line up RUN and PASS: lines.

Before:
=== RUN TestCount
--- PASS: TestCount (0.00s)
=== RUN: ExampleFields
--- PASS: ExampleFields (0.00s)

After:
=== RUN   TestCount
--- PASS: TestCount (0.00s)
=== RUN   ExampleFields
--- PASS: ExampleFields (0.00s)

Fixes #10594.

Change-Id: I189c80a5d99101ee72d8c9c3a4639c07e640cbd8
Reviewed-on: https://go-review.googlesource.com/9846
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-08 18:38:25 +00:00
Rob Pike
e9827f6201 testing: document that Log and Logf always print in benchmarks
Fixes #10713.

Change-Id: Ifdafc340ae3bba751236f0482246c568346a569c
Reviewed-on: https://go-review.googlesource.com/9763
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-06 20:59:36 +00:00
Matt T. Proud
b6a0450bec testing/quick: align tests with reflect.Kind.
This commit is largely cosmetic in the sense that it is the remnants
of a change proposal I had prepared for testing/quick, until I
discovered that 3e9ed27 already implemented the feature I was looking
for: quick.Value() for reflect.Kind Array.  What you see is a merger
and manual cleanup; the cosmetic cleanups are as follows:

(1.) Keeping the TestCheckEqual and its associated input functions
in the same order as type kinds defined in reflect.Kind.  Since
3e9ed27 was committed, the test case began to diverge from the
constant's ordering.

(2.) The `Intptr` derivatives existed to exercise quick.Value with
reflect.Kind's `Ptr` constant.  All `Intptr` (unrelated to `uintptr`)
in the test have been migrated to ensure the parallelism of the
listings and to convey that `Intptr` is not special.

(3.) Correct a misspelling (transposition) of "alias", whereby it is
named as "Alais".

Change-Id: I441450db16b8bb1272c52b0abcda3794dcd0599d
Reviewed-on: https://go-review.googlesource.com/8804
Reviewed-by: Russ Cox <rsc@golang.org>
2015-04-26 02:40:40 +00:00
Dmitry Vyukov
6b85090139 testing/quick: fix comment
There is no top-level Values function.

Change-Id: I3ea2eea0b5f77f3e1a3f75d1a6472507ef2888bb
Reviewed-on: https://go-review.googlesource.com/8196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-27 13:00:53 +00:00
Shenghou Ma
f63678ae91 testing: document that flag.Parse is not called when TestMain runs
Fixes #9825.

Change-Id: Id7eeaa14c26201db34db0820371c92a63af485b0
Reviewed-on: https://go-review.googlesource.com/7604
Reviewed-by: Rob Pike <r@golang.org>
2015-03-20 04:40:08 +00:00
Håvard Haugen
3d56fe6d94 testing: pad benchmark names to align results
Fixes #8780

Change-Id: I09cf01ff9722eed49086992a12774f2de81d16f2
Reviewed-on: https://go-review.googlesource.com/2840
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-07 21:52:25 +00:00
Chris Kastorff
3e9ed273a2 testing/quick: support generation of array types in Value
Generating array types like [4]int would fail even though the int type
is generatable. Allow generating values of array types when the inner
type is generatable.

Change-Id: I7d71b3c18edb3737e2fec1ddf5e36c9dc8401971
Reviewed-on: https://go-review.googlesource.com/3865
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-04 16:17:07 +00:00
Dmitry Vyukov
20004ba889 testing: add tracing support
testing part of tracing functionality:
https://docs.google.com/document/u/1/d/1FP5apqzBgr7ahCCgFO-yoVhk4YZrNIDNf9RybngBc14/pub
Full change:
https://codereview.appspot.com/146920043

Change-Id: Ia3c2c4417106937d5775b0e7064db92c1fc36679
Reviewed-on: https://go-review.googlesource.com/1461
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-28 16:43:00 +00:00
Robert Griesemer
c85a2bf9c2 testing/iotest: fix copy/paste error in comment
Reported via unsupported GitHub pull request:
https://github.com/golang/go/pull/9436/

Change-Id: I12b00e8ccac700bb36b200196e2867fcc863fdf1
Reviewed-on: https://go-review.googlesource.com/2139
Reviewed-by: Alan Donovan <adonovan@google.com>
2014-12-29 19:05:37 +00:00
Ian Lance Taylor
1e65616e1a testing: style change: omit unnecessary new
This was brought to my attention because a user thought that because
the file was named "example.go" it served as an example of good coding
practice.  It's not an example, of course, but may as well use a more
idiomatic style anyhow.

Change-Id: I7aa720f603f09f7d597fb7536dbf46ef09144e28
Reviewed-on: https://go-review.googlesource.com/1902
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-20 01:40:11 +00:00
Dmitriy Vyukov
8f47c837fd runtime: fix memory profiler
There are 3 issues:
1. Skip argument of callers is off by 3,
so that all allocations are deep inside of memory profiler.
2. Memory profiling statistics are not updated after runtime.GC.
3. Testing package does not update memory profiling statistics
before capturing the profile.
Also add an end-to-end test.
Fixes #8867.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/148710043
2014-10-16 22:11:26 +04:00
Robert Griesemer
5edff32704 testing: clearer comment
Fixes #8797.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/146680043
2014-10-01 13:19:40 -07:00
Russ Cox
182d1316dd cmd/go, testing: add TestMain support
Fixes #8202.

LGTM=r, bradfitz
R=r, josharian, bradfitz
CC=golang-codereviews
https://golang.org/cl/148770043
2014-09-19 13:51:06 -04:00
Russ Cox
e19d8a47d1 runtime: account for tiny allocs, for testing.AllocsPerRun
Fixes #8734.

LGTM=r, bradfitz, dvyukov
R=bradfitz, r, dvyukov
CC=golang-codereviews, iant, khr
https://golang.org/cl/143150043
2014-09-17 14:49:32 -04:00
Rob Pike
d33ee0c5e5 testing: read coverage counters atomically
For -mode=atomic, we need to read the counters
using an atomic load to avoid a race. Not worth worrying
about when -mode=atomic is set during generation
of the profile, so we use atomic loads always.

Fixes #8630.

LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/141800043
2014-09-09 12:31:07 -07:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
2014-09-08 00:08:51 -04:00