diff options
| author | Rob Pike <r@golang.org> | 2013-08-21 14:00:45 +1000 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2013-08-21 14:00:45 +1000 |
| commit | f578726de1d75b5816904972b0a29c1a5fdbda24 (patch) | |
| tree | 04e43ce4ce565cb1535669fd5b7db111bf86757c /src/pkg/encoding | |
| parent | a83b17c0b741263e7f3ad5ebb2e3aba27751c770 (diff) | |
| download | go-f578726de1d75b5816904972b0a29c1a5fdbda24.tar.xz | |
all: protect alloc count tests by -testing.short
Update #5000
Should reduce the flakiness a little. Malloc counting is important
to general testing but not to the build dashboard, which uses -short.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12866047
Diffstat (limited to 'src/pkg/encoding')
| -rw-r--r-- | src/pkg/encoding/gob/timing_test.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pkg/encoding/gob/timing_test.go b/src/pkg/encoding/gob/timing_test.go index f589675dd9..9fbb0ac6d5 100644 --- a/src/pkg/encoding/gob/timing_test.go +++ b/src/pkg/encoding/gob/timing_test.go @@ -6,7 +6,6 @@ package gob import ( "bytes" - "fmt" "io" "os" "runtime" @@ -50,6 +49,9 @@ func BenchmarkEndToEndByteBuffer(b *testing.B) { } func TestCountEncodeMallocs(t *testing.T) { + if testing.Short() { + t.Skip("skipping malloc count in short mode") + } if runtime.GOMAXPROCS(0) > 1 { t.Skip("skipping; GOMAXPROCS>1") } @@ -66,10 +68,15 @@ func TestCountEncodeMallocs(t *testing.T) { t.Fatal("encode:", err) } }) - fmt.Printf("mallocs per encode of type Bench: %v\n", allocs) + if allocs != 0 { + t.Fatalf("mallocs per encode of type Bench: %v; wanted 0\n", allocs) + } } func TestCountDecodeMallocs(t *testing.T) { + if testing.Short() { + t.Skip("skipping malloc count in short mode") + } if runtime.GOMAXPROCS(0) > 1 { t.Skip("skipping; GOMAXPROCS>1") } @@ -96,5 +103,7 @@ func TestCountDecodeMallocs(t *testing.T) { t.Fatal("decode:", err) } }) - fmt.Printf("mallocs per decode of type Bench: %v\n", allocs) + if allocs != 3 { + t.Fatalf("mallocs per decode of type Bench: %v; wanted 3\n", allocs) + } } |
