diff options
author | Josh MacDonald <josh.macdonald@gmail.com> | 2015-11-03 23:34:00 -0800 |
---|---|---|
committer | Josh MacDonald <josh.macdonald@gmail.com> | 2015-11-03 23:34:00 -0800 |
commit | 6116f8879faff1a8145f55d9f537c33f39931678 (patch) | |
tree | 3f24cd35c4b238bc77cd4bfa0e3f33cccca6677a /xdelta3/go/src/regtest.go | |
parent | 65e39a369ce7befe18cfcb350e4d3cc391cc09f2 (diff) |
Test exposed XD3_TOOFARBACK in default branch (despite not yet WAI), caused by inconsistent frontier_pos handling with source FIFO
Diffstat (limited to 'xdelta3/go/src/regtest.go')
-rw-r--r-- | xdelta3/go/src/regtest.go | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/xdelta3/go/src/regtest.go b/xdelta3/go/src/regtest.go index 6497166..b028ed5 100644 --- a/xdelta3/go/src/regtest.go +++ b/xdelta3/go/src/regtest.go | |||
@@ -10,8 +10,8 @@ import ( | |||
10 | 10 | ||
11 | const ( | 11 | const ( |
12 | blocksize = 1<<16 | 12 | blocksize = 1<<16 |
13 | winsize = 1<<26 | 13 | winsize = 1<<22 |
14 | xdelta3 = "/volume/home/jmacd/src/xdelta-64bithash/xdelta3/build/x86_64-pc-linux-gnu-m64/usize64/xoff64/xdelta3" | 14 | xdelta3 = "/volume/home/jmacd/src/xdelta-devel/xdelta3/xdelta3" |
15 | seed = 1422253499919909358 | 15 | seed = 1422253499919909358 |
16 | ) | 16 | ) |
17 | 17 | ||
@@ -20,32 +20,32 @@ func smokeTest(r *xdelta.Runner, t *xdelta.TestGroup, p *xdelta.Program) { | |||
20 | target := "Hello world!" | 20 | target := "Hello world!" |
21 | source := "Hello world, nice to meet you!" | 21 | source := "Hello world, nice to meet you!" |
22 | 22 | ||
23 | run, err := r.Exec(p, true, []string{"-evv"}) | 23 | enc, err := r.Exec(p, true, []string{"-evv"}) |
24 | if err != nil { | 24 | if err != nil { |
25 | t.Panic(err) | 25 | t.Panic(err) |
26 | } | 26 | } |
27 | encodeout := t.Drain(run.Stdout, "encode.stdout") | 27 | encodeout := t.Drain(enc.Stdout, "encode.stdout") |
28 | t.Empty(run.Stderr, "encode") | 28 | t.Empty(enc.Stderr, "encode") |
29 | 29 | ||
30 | t.Write("encode.stdin", run.Stdin, []byte(target)) | 30 | t.Write("encode.stdin", enc.Stdin, []byte(target)) |
31 | t.Write("encode.srcin", run.Srcin, []byte(source)) | 31 | t.Write("encode.srcin", enc.Srcin, []byte(source)) |
32 | 32 | ||
33 | if err := run.Cmd.Wait(); err != nil { | 33 | if err := enc.Cmd.Wait(); err != nil { |
34 | t.Panic(err) | 34 | t.Panic(err) |
35 | } | 35 | } |
36 | 36 | ||
37 | run, err = r.Exec(p, true, []string{"-dvv"}) | 37 | dec, err := r.Exec(p, true, []string{"-dvv"}) |
38 | if err != nil { | 38 | if err != nil { |
39 | t.Panic(err) | 39 | t.Panic(err) |
40 | } | 40 | } |
41 | 41 | ||
42 | decodeout := t.Drain(run.Stdout, "decode.stdout") | 42 | decodeout := t.Drain(dec.Stdout, "decode.stdout") |
43 | t.Empty(run.Stderr, "decode") | 43 | t.Empty(dec.Stderr, "decode") |
44 | 44 | ||
45 | t.Write("decode.stdin", run.Stdin, <-encodeout) | 45 | t.Write("decode.stdin", dec.Stdin, <-encodeout) |
46 | t.Write("decode.srcin", run.Srcin, []byte(source)) | 46 | t.Write("decode.srcin", dec.Srcin, []byte(source)) |
47 | decoded := string(<-decodeout) | 47 | decoded := string(<-decodeout) |
48 | if err := run.Cmd.Wait(); err != nil { | 48 | if err := dec.Cmd.Wait(); err != nil { |
49 | t.Panic(err) | 49 | t.Panic(err) |
50 | } | 50 | } |
51 | if decoded != target { | 51 | if decoded != target { |
@@ -55,9 +55,9 @@ func smokeTest(r *xdelta.Runner, t *xdelta.TestGroup, p *xdelta.Program) { | |||
55 | fmt.Println("Smoketest pass") | 55 | fmt.Println("Smoketest pass") |
56 | } | 56 | } |
57 | 57 | ||
58 | func offsetTest(r *xdelta.Runner, t *xdelta.TestGroup, p *xdelta.Program, offset, bufsize, length int64) { | 58 | func offsetTest(r *xdelta.Runner, t *xdelta.TestGroup, p *xdelta.Program, bufsize, offset, length int64) { |
59 | t.Add(1) | 59 | t.Add(1) |
60 | eargs := []string{"-e", "-1", "-N", fmt.Sprint("-B", bufsize), "-vv", fmt.Sprint("-W", winsize)} | 60 | eargs := []string{"-e", "-0", fmt.Sprint("-B", bufsize), "-vv", fmt.Sprint("-W", winsize)} |
61 | enc, err := r.Exec(p, true, eargs) | 61 | enc, err := r.Exec(p, true, eargs) |
62 | if err != nil { | 62 | if err != nil { |
63 | t.Panic(err) | 63 | t.Panic(err) |
@@ -78,7 +78,7 @@ func offsetTest(r *xdelta.Runner, t *xdelta.TestGroup, p *xdelta.Program, offset | |||
78 | 78 | ||
79 | // TODO: seems possible to use one WriteRstreams call to generate | 79 | // TODO: seems possible to use one WriteRstreams call to generate |
80 | // the source and target for both encoder and decoder. Why not? | 80 | // the source and target for both encoder and decoder. Why not? |
81 | xdelta.WriteRstreams(t, seed, offset, length, enc.Srcin, enc. Stdin) | 81 | xdelta.WriteRstreams(t, seed, offset, length, enc.Srcin, enc.Stdin) |
82 | xdelta.WriteRstreams(t, seed, offset, length, dec.Srcin, write) | 82 | xdelta.WriteRstreams(t, seed, offset, length, dec.Srcin, write) |
83 | 83 | ||
84 | if err := enc.Cmd.Wait(); err != nil { | 84 | if err := enc.Cmd.Wait(); err != nil { |
@@ -100,6 +100,7 @@ func main() { | |||
100 | prog := &xdelta.Program{xdelta3} | 100 | prog := &xdelta.Program{xdelta3} |
101 | 101 | ||
102 | smokeTest(r, xdelta.NewTestGroup(), prog) | 102 | smokeTest(r, xdelta.NewTestGroup(), prog) |
103 | offsetTest(r, xdelta.NewTestGroup(), prog, 4 << 20, 3 << 20, 5 << 20) | ||
103 | 104 | ||
104 | offsetTest(r, xdelta.NewTestGroup(), prog, 1 << 31, 1 << 32, 1 << 33) | 105 | //offsetTest(r, xdelta.NewTestGroup(), prog, 1 << 31, 1 << 32, 1 << 33) |
105 | } | 106 | } |