summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-regtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-regtest.py')
-rwxr-xr-xxdelta3/xdelta3-regtest.py54
1 files changed, 29 insertions, 25 deletions
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index f8edb9e..adc240e 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -24,7 +24,7 @@ import xdelta3main
24import xdelta3 24import xdelta3
25 25
26#RCSDIR = '/mnt/polaroid/Polaroid/orbit_linux/home/jmacd/PRCS' 26#RCSDIR = '/mnt/polaroid/Polaroid/orbit_linux/home/jmacd/PRCS'
27RCSDIR = '/tmp/PRCS_read_copy/prcs' 27RCSDIR = '/tmp/PRCS_read_copy'
28SAMPLEDIR = "/tmp/WESNOTH_tmp/diff" 28SAMPLEDIR = "/tmp/WESNOTH_tmp/diff"
29 29
30#RCSDIR = 'G:/jmacd/PRCS/prcs/b' 30#RCSDIR = 'G:/jmacd/PRCS/prcs/b'
@@ -39,12 +39,14 @@ SKIP_TRIALS = 2
39MIN_TRIALS = 3 39MIN_TRIALS = 3
40MAX_TRIALS = 15 40MAX_TRIALS = 15
41 41
42SKIP_DECODE = 1
43
42# 10 = fast 1.5 = slow 44# 10 = fast 1.5 = slow
43MIN_STDDEV_PCT = 1.5 45MIN_STDDEV_PCT = 1.5
44 46
45# How many results per round 47# How many results per round
46MAX_RESULTS = 4 48MAX_RESULTS = 400
47KEEP_P = (1.0) 49KEEP_P = (0.5)
48FAST_P = (0.0) 50FAST_P = (0.0)
49SLOW_P = (0.0) 51SLOW_P = (0.0)
50 52
@@ -98,18 +100,18 @@ def INPUT_SPEC(rand):
98 100
99 # -C 1,2,3,4,5,6,7 101 # -C 1,2,3,4,5,6,7
100 'large_look' : lambda d: rand.choice([9]), 102 'large_look' : lambda d: rand.choice([9]),
101 'large_step' : lambda d: rand.choice([15]), 103 'large_step' : lambda d: rand.choice([2, 3, 8, 15]),
102 'small_chain' : lambda d: rand.choice([1]), 104 'small_chain' : lambda d: rand.choice([40, 10, 4, 1]),
103 'small_lchain' : lambda d: rand.choice([1]), 105 'small_lchain' : lambda d: rand.choice([x for x in [10, 4, 2, 1] if x <= d['small_chain']]),
104 'max_lazy' : lambda d: rand.choice([18]), 106 'max_lazy' : lambda d: rand.choice([9, 18, 27, 36, 72, 108]),
105 'long_enough' : lambda d: rand.choice([18]), 107 'long_enough' : lambda d: rand.choice([9, 18, 27, 36, 72, 108]),
106 'small_look' : lambda d: rand.choice([4, 5]), 108 'small_look' : lambda d: rand.choice([4]),
107 109
108 # -N 110 # -N
109 'nocompress' : lambda d: rand.choice(['false']), 111 'nocompress' : lambda d: rand.choice(['false']),
110 112
111 # -T 113 # -T
112 'altcode' : lambda d: rand.choice(['false', 'true']), 114 'altcode' : lambda d: rand.choice(['false']),
113 115
114 # -S djw 116 # -S djw
115 'djw' : lambda d: rand.choice(['false']), 117 'djw' : lambda d: rand.choice(['false']),
@@ -165,7 +167,7 @@ def SumList(l):
165# returns (total, mean, stddev, q2 (median), 167# returns (total, mean, stddev, q2 (median),
166# (q3-q1)/2 ("semi-interquartile range"), max-min (spread)) 168# (q3-q1)/2 ("semi-interquartile range"), max-min (spread))
167class StatList: 169class StatList:
168 def __init__(self,l,desc,hist=0): 170 def __init__(self,l,desc):
169 cnt = len(l) 171 cnt = len(l)
170 assert(cnt > 1) 172 assert(cnt > 1)
171 l.sort() 173 l.sort()
@@ -227,8 +229,15 @@ class TimedTest:
227 self.encode_time = self.DoTest(DFILE, 229 self.encode_time = self.DoTest(DFILE,
228 lambda x: x.Encode(self.target, self.source, DFILE)) 230 lambda x: x.Encode(self.target, self.source, DFILE))
229 self.encode_size = runnable.EncodeSize(DFILE) 231 self.encode_size = runnable.EncodeSize(DFILE)
232
233 if SKIP_DECODE:
234 self.decode_time = StatList([1, 1], 'not decoded')
235 return
236 #end
237
230 self.decode_time = self.DoTest(RFILE, 238 self.decode_time = self.DoTest(RFILE,
231 lambda x: x.Decode(DFILE, self.source, RFILE)) 239 lambda x: x.Decode(DFILE, self.source, RFILE),
240 )
232 241
233 # verify 242 # verify
234 runnable.Verify(self.target, RFILE) 243 runnable.Verify(self.target, RFILE)
@@ -658,15 +667,6 @@ class RcsFile:
658 667
659 target_size = os.stat(self.Verf(v+1)).st_size 668 target_size = os.stat(self.Verf(v+1)).st_size
660 669
661 if 0:
662 print '%s %s %s: %.2f%% encode %.3f ms: decode %.3f ms' % \
663 (runclass,
664 os.path.basename(self.fname),
665 self.Vstr(v+1),
666 target_size > 0 and (100.0 * result.encode_size / target_size) or 0,
667 result.encode_time.mean * 1000.0,
668 result.decode_time.mean * 1000.0)
669 #end
670 ntrials.append(result) 670 ntrials.append(result)
671 #end 671 #end
672 672
@@ -780,8 +780,8 @@ def GetTestRcsFiles():
780 len(rcsf.subdirs), 780 len(rcsf.subdirs),
781 len(rcsf.others), 781 len(rcsf.others),
782 len(rcsf.skipped)) 782 len(rcsf.skipped))
783 print StatList([x.rcssize for x in rcsf.rcsfiles], "rcssize", 1).str 783 print StatList([x.rcssize for x in rcsf.rcsfiles], "rcssize").str
784 print StatList([x.totrev for x in rcsf.rcsfiles], "totrev", 1).str 784 print StatList([x.totrev for x in rcsf.rcsfiles], "totrev").str
785 return rcsf 785 return rcsf
786#end 786#end
787 787
@@ -800,11 +800,15 @@ class RandomTestResult:
800 #end 800 #end
801 801
802 def __str__(self): 802 def __str__(self):
803 return 'time %.6f%s size %d%s << %s >> %.6f' % ( 803 decodestr = ''
804 if not SKIP_DECODE:
805 decodestr = ' %.6f' % self.decodetime
806 #end
807 return 'time %.6f%s size %d%s << %s >>%s' % (
804 self.time(), ((self.time_pos != None) and (" (%s)" % self.time_pos) or ""), 808 self.time(), ((self.time_pos != None) and (" (%s)" % self.time_pos) or ""),
805 self.size(), ((self.size_pos != None) and (" (%s)" % self.size_pos) or ""), 809 self.size(), ((self.size_pos != None) and (" (%s)" % self.size_pos) or ""),
806 c2s(self.config()), 810 c2s(self.config()),
807 self.decodetime) 811 decodestr)
808 #end 812 #end
809 813
810 def time(self): 814 def time(self):