diff options
author | Russ Cox <rsc@golang.org> | 2011-03-05 14:35:03 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-03-05 14:35:03 -0500 |
commit | d044674a0dbca127307bf37f32348874110f3ec6 (patch) | |
tree | da101f5a41c890d1ce6a4d52cf1a60d9b4f98928 | |
parent | 11695596588172331984de8a443eedbd44c56bd5 (diff) | |
download | go-d044674a0dbca127307bf37f32348874110f3ec6.tar.gz go-d044674a0dbca127307bf37f32348874110f3ec6.zip |
compress/flate: fix test
The test was checking for a buffer to be empty but
actually racing with the background goroutine that
was emptying it. Left a comment so that the check
is not reintroduced later.
Fixes #1557.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4248063
-rw-r--r-- | src/pkg/compress/flate/deflate_test.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pkg/compress/flate/deflate_test.go b/src/pkg/compress/flate/deflate_test.go index ff54164b2c..ed5884a4b7 100644 --- a/src/pkg/compress/flate/deflate_test.go +++ b/src/pkg/compress/flate/deflate_test.go @@ -191,9 +191,16 @@ func testSync(t *testing.T, level int, input []byte, name string) { t.Errorf("testSync/%d: read wrong bytes: %x vs %x", i, input[lo:hi], out[:hi-lo]) return } - if i == 0 && buf.buf.Len() != 0 { - t.Errorf("testSync/%d (%d, %d, %s): extra data after %d", i, level, len(input), name, hi-lo) - } + // This test originally checked that after reading + // the first half of the input, there was nothing left + // in the read buffer (buf.buf.Len() != 0) but that is + // not necessarily the case: the write Flush may emit + // some extra framing bits that are not necessary + // to process to obtain the first half of the uncompressed + // data. The test ran correctly most of the time, because + // the background goroutine had usually read even + // those extra bits by now, but it's not a useful thing to + // check. buf.WriteMode() } buf.ReadMode() |