diff options
author | Joshua MacDonald <josh.macdonald@gmail.com> | 2015-11-29 23:14:04 -0800 |
---|---|---|
committer | Joshua MacDonald <josh.macdonald@gmail.com> | 2015-11-29 23:14:04 -0800 |
commit | bdcbbc839ca7fd3e8edd1617bbf9bfdba4bf543d (patch) | |
tree | d2ed2ff8a4972c3e88db485f1d7c40d173eedd46 /xdelta3/go/src/regtest.go | |
parent | 4b74451f9e9b976a2a0984130662f58bd39e1478 (diff) |
Test this on Linux
Diffstat (limited to 'xdelta3/go/src/regtest.go')
-rw-r--r-- | xdelta3/go/src/regtest.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/xdelta3/go/src/regtest.go b/xdelta3/go/src/regtest.go index 4507b8c..85bd43a 100644 --- a/xdelta3/go/src/regtest.go +++ b/xdelta3/go/src/regtest.go | |||
@@ -57,14 +57,20 @@ func smokeTest(r *xdelta.Runner, p *xdelta.Program) { | |||
57 | } | 57 | } |
58 | 58 | ||
59 | func offsetTest(r *xdelta.Runner, p *xdelta.Program, bufsize, offset, length int64) { | 59 | func offsetTest(r *xdelta.Runner, p *xdelta.Program, bufsize, offset, length int64) { |
60 | // Note there is a strong potential to deadlock or fail due to | ||
61 | // a broken test in this test for several reasons: | ||
62 | // (a) decoder is not required to read the entire source file | ||
63 | // (b) decoder defers open to source file until first window received | ||
64 | // (c) open on a fifo blocks until a reader opens | ||
65 | // (d) sub-process Wait can invalidate busy file descriptors | ||
60 | t, g := xdelta.NewTestGroup(r) | 66 | t, g := xdelta.NewTestGroup(r) |
61 | eargs := []string{"-e", "-0", fmt.Sprint("-B", bufsize), "-vv", fmt.Sprint("-W", winsize)} | 67 | eargs := []string{"-e", "-0", fmt.Sprint("-B", bufsize), "-vvvvvvv", fmt.Sprint("-W", winsize)} |
62 | enc, err := t.Exec("encode", p, true, eargs) | 68 | enc, err := t.Exec("encode", p, true, eargs) |
63 | if err != nil { | 69 | if err != nil { |
64 | g.Panic(err) | 70 | g.Panic(err) |
65 | } | 71 | } |
66 | 72 | ||
67 | dargs := []string{"-d", fmt.Sprint("-B", bufsize), "-vv", fmt.Sprint("-W", winsize)} | 73 | dargs := []string{"-d", fmt.Sprint("-B", bufsize), "-vvvvvvv", fmt.Sprint("-W", winsize)} |
68 | dec, err := t.Exec("decode", p, true, dargs) | 74 | dec, err := t.Exec("decode", p, true, dargs) |
69 | if err != nil { | 75 | if err != nil { |
70 | g.Panic(err) | 76 | g.Panic(err) |
@@ -79,10 +85,10 @@ func offsetTest(r *xdelta.Runner, p *xdelta.Program, bufsize, offset, length int | |||
79 | t.CompareStreams(dec.Stdout, read, length) | 85 | t.CompareStreams(dec.Stdout, read, length) |
80 | 86 | ||
81 | // The decoder output ("read", above) is compared with the | 87 | // The decoder output ("read", above) is compared with the |
82 | // test-provided output ("write", below). | 88 | // test-provided output ("write", below). The following |
83 | xdelta.WriteRstreams(t, seed, offset, length, | 89 | // generates the input and output twice. |
84 | t.NewDualWriter(enc.Srcin, dec.Srcin), | 90 | t.WriteRstreams("encode", seed, offset, length, enc.Srcin, dec.Srcin) |
85 | t.NewDualWriter(dec.Srcin, write)) | 91 | t.WriteRstreams("decode", seed, offset, length, dec.Srcin, write) |
86 | t.Wait(g, enc, dec) | 92 | t.Wait(g, enc, dec) |
87 | } | 93 | } |
88 | 94 | ||