From b24969720ac9c92f3d7327250b3ee8e86acc6def Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Mon, 23 Nov 2015 20:28:05 -0800 Subject: Improve error handling; allow two routines to have errors in a successful test (Empty, which can get bad file descriptor after the process exits, and the Decode-Source writer, since the decoder is not required to read the full source) --- xdelta3/go/src/xdelta/rstream.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xdelta3/go/src/xdelta/rstream.go') diff --git a/xdelta3/go/src/xdelta/rstream.go b/xdelta3/go/src/xdelta/rstream.go index 3f520d7..e31b0b0 100644 --- a/xdelta3/go/src/xdelta/rstream.go +++ b/xdelta3/go/src/xdelta/rstream.go @@ -10,17 +10,20 @@ const ( blocksize = 16380 ) -func WriteRstreams(t *TestGroup, seed, offset, len int64, +func WriteRstreams(t *TestGroup, desc string, seed, offset, len int64, src, tgt io.WriteCloser) { - t.Go("src", func (g Goroutine) { - go writeOne(g, seed, 0, len, src) + t.Go("src-write:"+desc, func (g Goroutine) { + writeOne(g, seed, 0, len, src, false) }) - t.Go("tgt", func (g Goroutine) { - go writeOne(g, seed, offset, len, tgt) + t.Go("tgt-write:"+desc, func (g Goroutine) { + writeOne(g, seed, offset, len, tgt, true) }) } -func writeOne(g Goroutine, seed, offset, len int64, stream io.WriteCloser) { +func writeOne(g Goroutine, seed, offset, len int64, stream io.WriteCloser, readall bool) { + if !readall { + g.OK() + } if offset != 0 { // Fill with other random data until the offset if err := writeRand(rand.New(rand.NewSource(^seed)), offset, stream); err != nil { -- cgit v1.2.3