diff options
Diffstat (limited to 'xdelta3/go/src/xdelta/test.go')
-rw-r--r-- | xdelta3/go/src/xdelta/test.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xdelta3/go/src/xdelta/test.go b/xdelta3/go/src/xdelta/test.go index 9eb47f6..e853554 100644 --- a/xdelta3/go/src/xdelta/test.go +++ b/xdelta3/go/src/xdelta/test.go | |||
@@ -31,6 +31,8 @@ type Runner struct { | |||
31 | 31 | ||
32 | type TestGroup struct { | 32 | type TestGroup struct { |
33 | sync.WaitGroup | 33 | sync.WaitGroup |
34 | sync.Mutex | ||
35 | errs []error | ||
34 | } | 36 | } |
35 | 37 | ||
36 | type Run struct { | 38 | type Run struct { |
@@ -42,10 +44,17 @@ type Run struct { | |||
42 | Stderr io.ReadCloser | 44 | Stderr io.ReadCloser |
43 | } | 45 | } |
44 | 46 | ||
47 | |||
45 | func (t *TestGroup) Panic(err error) { | 48 | func (t *TestGroup) Panic(err error) { |
49 | t.Lock() | ||
50 | t.errs = append(t.errs, err) | ||
51 | t.Unlock() | ||
46 | t.Done() // For the caller | 52 | t.Done() // For the caller |
47 | t.Wait() | 53 | t.Wait() |
48 | panic(err) | 54 | for _, e := range t.errs { |
55 | fmt.Println(e) | ||
56 | } | ||
57 | panic(fmt.Sprintf("%d errors", len(t.errs))) | ||
49 | } | 58 | } |
50 | 59 | ||
51 | func NewTestGroup() *TestGroup { | 60 | func NewTestGroup() *TestGroup { |
@@ -185,9 +194,8 @@ func (r *Runner) Exec(p *Program, srcfifo bool, flags []string) (*Run, error) { | |||
185 | run.Cmd.Path = p.Path | 194 | run.Cmd.Path = p.Path |
186 | run.Cmd.Args = append(args, flags...) | 195 | run.Cmd.Args = append(args, flags...) |
187 | run.Cmd.Dir = r.Testdir | 196 | run.Cmd.Dir = r.Testdir |
188 | run.Cmd.Start() | ||
189 | 197 | ||
190 | return run, nil | 198 | return run, run.Cmd.Start() |
191 | } | 199 | } |
192 | 200 | ||
193 | func writeFifo(srcfile string, read io.Reader) error { | 201 | func writeFifo(srcfile string, read io.Reader) error { |