print 'dir is', self.dir
def __del__ (self):
print 'rm -rf %s' % self.dir
- os.system ('rm -rf %s' % self.dir )
+ os.system ('rm -rf %s' % self.dir)
def __call__ (self):
return self.dir
system ("convert -depth 8 %(dir)s/diff.png -blur 0x3 -negate -channel alpha,blue -type TrueColorMatte -fx 'intensity' %(dir)s/matte.png" % locals ())
- system ("composite -quality 65 %(dir)s/matte.png %(new)s %(dest)s" % locals ())
+ system ("composite -compose atop -quality 65 %(dir)s/matte.png %(new)s %(dest)s" % locals ())
################################################################
return 0.0
else:
return 100.0;
-
def get_content (self, f):
print 'reading', f
return s
-
-
class GitFileCompareLink (FileCompareLink):
def get_cell (self, oldnew):
str = self.contents[oldnew]
str = '<font size="-2"><pre>%s</pre></font>' % str
return str
+class LogFileCompareLink (TextFileCompareLink):
+ def get_content (self, f):
+ c = TextFileCompareLink.get_content (self, f)
+ c = re.sub ("\nProcessing `[^\n]+'\n", '', c)
+ return c
class ProfileFileLink (FileCompareLink):
def __init__ (self, f1, f2):
dist = 0.0
factor = {
- 'time': 1.0 ,
+ 'time': 0.1,
'cells': 5.0,
}
return d + orphan_distance
-
-
def add_file_compare (self, f1, f2):
system_index = []
for f in glob.glob (pat):
infile = f
outfile = (dest_dir + '/' + f).replace ('.eps', '.png')
-
+ data_option = ''
+ if options.local_data_dir:
+ data_option = ('-slilypond-datadir=%s/../share/lilypond/current '
+ % os.path.dirname(infile))
+
mkdir (os.path.split (outfile)[0])
cmd = ('gs -sDEVICE=png16m -dGraphicsAlphaBits=4 -dTextAlphaBits=4 '
+ ' %(data_option)s '
' -r101 '
' -sOutputFile=%(outfile)s -dNOSAFER -dEPSCrop -q -dNOPAUSE '
- ' %(infile)s -c quit ' % locals ())
+ ' %(infile)s -c quit ') % locals ()
files_created[oldnew].append (outfile)
system (cmd)
pairs = []
missing = []
- for f in files[0].keys ():
+ for f in files[0]:
try:
files[1].pop (f)
pairs.append (f)
ext = os.path.splitext (f1)[1]
klasses = {
'.midi': MidiFileLink,
- '.log' : TextFileCompareLink,
+ '.log' : LogFileCompareLink,
'.profile': ProfileFileLink,
'.gittxt': GitFileCompareLink,
}
names = [d['name'] for d in dicts]
- system ('lilypond -ddump-profile -dseparate-log-files -ddump-signatures --png -b eps ' + ' '.join (names))
+ system ('lilypond -ddump-profile -dseparate-log-files -ddump-signatures --png -dbackend=eps ' + ' '.join (names))
multipage_str = r'''
test_compare_signatures (names)
def test_compare_signatures (names, timing=False):
-
import time
times = 1
action="store_true",
help="Create PNGs from EPSes")
+
+ p.add_option ('--local-datadir',
+ dest="local_data_dir",
+ default=False,
+ action="store_true",
+ help='whether to use the share/lilypond/ directory in the test directory')
+
p.add_option ('-o', '--output-dir',
dest="output_dir",
default=None,
help='where to put the test results [tree2/compare-tree1tree2]')
global options
- (options, a) = p.parse_args ()
+ (options, args) = p.parse_args ()
if options.run_test:
run_tests ()
sys.exit (0)
- if len (a) != 2:
+ if len (args) != 2:
p.print_usage()
sys.exit (2)
name = options.output_dir
if not name:
- name = a[0].replace ('/', '')
- name = os.path.join (a[1], 'compare-' + shorten_string (name))
+ name = args[0].replace ('/', '')
+ name = os.path.join (args[1], 'compare-' + shorten_string (name))
- compare_trees (a[0], a[1], name, options.threshold)
+ compare_trees (args[0], args[1], name, options.threshold)
if __name__ == '__main__':
main()