mirror of
https://github.com/golang/go
synced 2024-11-14 08:40:27 -07:00
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
This commit is contained in:
parent
1169559658
commit
d044674a0d
@ -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])
|
t.Errorf("testSync/%d: read wrong bytes: %x vs %x", i, input[lo:hi], out[:hi-lo])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if i == 0 && buf.buf.Len() != 0 {
|
// This test originally checked that after reading
|
||||||
t.Errorf("testSync/%d (%d, %d, %s): extra data after %d", i, level, len(input), name, hi-lo)
|
// 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.WriteMode()
|
||||||
}
|
}
|
||||||
buf.ReadMode()
|
buf.ReadMode()
|
||||||
|
Loading…
Reference in New Issue
Block a user