summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-regtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-regtest.py')
-rwxr-xr-xxdelta3/xdelta3-regtest.py38
1 files changed, 21 insertions, 17 deletions
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index 33f0715..1b84940 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -44,10 +44,10 @@ MAX_RUN = 1000 * 1000 * 10
44 44
45# How many results per round 45# How many results per round
46MAX_RESULTS = 100 46MAX_RESULTS = 100
47KEEP_P = (0.3) 47KEEP_P = (0.5)
48FAST_P = (0.0) 48FAST_P = (0.0)
49SLOW_P = (0.0) 49SLOW_P = (0.0)
50FILE_P = (0.50) 50FILE_P = (0.30)
51 51
52CONFIG_ORDER = [ 'large_look', 52CONFIG_ORDER = [ 'large_look',
53 'large_step', 53 'large_step',
@@ -62,16 +62,16 @@ CONFIG_ORDER = [ 'large_look',
62 62
63def INPUT_SPEC(rand): 63def INPUT_SPEC(rand):
64 return { 64 return {
65 'large_look' : lambda d: rand.choice([9]), 65 'large_look' : lambda d: rand.choice([9, 11, 13, 15]),
66 'large_step' : lambda d: rand.choice([4, 5]), 66 'large_step' : lambda d: rand.choice([11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ]),
67 67
68 'small_chain' : lambda d: rand.randrange(4, 65, 4), 68 'small_chain' : lambda d: rand.choice([1]),
69 'small_lchain' : lambda d: rand.randrange(1, 17, 1), 69 'small_lchain' : lambda d: rand.choice([1]),
70 70
71 'max_lazy' : lambda d: rand.choice([18]), 71 'max_lazy' : lambda d: rand.choice([9, 13, 18]),
72 'long_enough' : lambda d: rand.choice([35]), 72 'long_enough' : lambda d: rand.choice([9, 13, 18]),
73 73
74 'small_look' : lambda d: 4, 74 'small_look' : lambda d: rand.choice([4]),
75 'promote' : lambda d: 0, 75 'promote' : lambda d: 0,
76 'trylazy' : lambda d: 1, 76 'trylazy' : lambda d: 1,
77 'ssmatch' : lambda d: 0, 77 'ssmatch' : lambda d: 0,
@@ -782,12 +782,8 @@ class RandomTester:
782 t_rect = time_major - 1.0 782 t_rect = time_major - 1.0
783 s_rect = size_minor - 1.0 783 s_rect = size_minor - 1.0
784 784
785 assert(time_major >= size_minor)
786
787 rect_ratio = s_rect / t_rect 785 rect_ratio = s_rect / t_rect
788 786
789 assert(rect_ratio <= 1.000001)
790
791 for test in self.results: 787 for test in self.results:
792 788
793 # Transform the major min/max region linearly to normalize the 789 # Transform the major min/max region linearly to normalize the
@@ -851,6 +847,7 @@ class RandomTester:
851 test_totals[c].append(test) 847 test_totals[c].append(test)
852 #end 848 #end
853 s = 0.0 849 s = 0.0
850 self.results.append(test)
854 r.append(test.config()) 851 r.append(test.config())
855 all_r = test_totals[c] 852 all_r = test_totals[c]
856 for t in all_r: 853 for t in all_r:
@@ -867,7 +864,6 @@ class RandomTester:
867 print 'Score: %0.6f %s (%.1f%s%s)' % \ 864 print 'Score: %0.6f %s (%.1f%s%s)' % \
868 (test.score, test, s / len(all_r), stars, (len(all_r) > 2) and (' in %d' % len(all_r)) or "") 865 (test.score, test, s / len(all_r), stars, (len(all_r) > 2) and (' in %d' % len(all_r)) or "")
869 #end 866 #end
870
871 867
872 return r 868 return r
873 #end 869 #end
@@ -887,19 +883,27 @@ if __name__ == "__main__":
887 try: 883 try:
888 RunCommand(['rm', '-rf', TMPDIR]) 884 RunCommand(['rm', '-rf', TMPDIR])
889 os.mkdir(TMPDIR) 885 os.mkdir(TMPDIR)
890 rcsf = Test() 886 #rcsf = Test()
891 configs = [] 887 configs = []
892 888
893 while 1: 889 while 1:
894 #f1 = '/tmp/big.1' 890 #f1 = '/tmp/big.1'
895 #f2 = '/tmp/big.2' 891 #f2 = '/tmp/big.2'
896 test = RandomTester(configs) 892 test = RandomTester(configs)
897 f1, f2 = test.MakeBigFiles(rcsf) 893 #f1, f2 = test.MakeBigFiles(rcsf)
898 while not test.HasEnoughResults(): 894 while not test.HasEnoughResults():
895 f1 = '/tmp/WESNOTH_tmp/wesnoth-1.1.12.tar'
896 f2 = '/tmp/WESNOTH_tmp/wesnoth-1.1.13.tar'
897 #f1 = '/tmp/big.1'
898 #f2 = '/tmp/big.2'
899 test.RandomBigRun(f1, f2) 899 test.RandomBigRun(f1, f2)
900 #end 900 #end
901 configs = test.ScoreTests() 901 configs = test.ScoreTests()
902 test.Reset() 902
903 #test.Reset()
904 test.results = test.results[0:len(configs)]
905 configs = []
906 #break
903 #end 907 #end
904 #end 908 #end
905 909