]> git.donarmstrong.com Git - lilypond.git/commitdiff
Speed up test target.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Jan 2007 01:34:06 +0000 (02:34 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Jan 2007 01:34:06 +0000 (02:34 +0100)
Don't create PNG images for all files. Rather create PNGs for changed
EPSs only.

GNUmakefile.in
buildscripts/output-distance.py
scripts/lilypond-book.py

index 04a002a282990b69939415516084896dc5c72d90..d49d29fc9f3309f863e0e5e5fb2a592127977bd5 100644 (file)
@@ -211,7 +211,7 @@ test-clean:
 
 test:
 ## no aa-scaling, no PDF
-       $(MAKE) -C input/regression/ out=test LILYPOND_BOOK_LILYPOND_FLAGS="--backend=eps --formats=ps,png $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -ddump-profile -dcheck-internal-types -ddump-signatures -danti-alias-factor=1" LILYPOND_BOOK_VERBOSE= out-test/collated-files.html 
+       $(MAKE) -C input/regression/ out=test LILYPOND_BOOK_LILYPOND_FLAGS="--backend=eps --formats=ps $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -ddump-profile -dcheck-internal-types -ddump-signatures -danti-alias-factor=1" LILYPOND_BOOK_VERBOSE= out-test/collated-files.html 
        @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g' 
 
 
@@ -220,4 +220,4 @@ RESULT_DIR=$(top-build-dir)/out/test-results/
 local-check: test
        rm -rf $(RESULT_DIR)
        mkdir -p $(RESULT_DIR)
-       $(PYTHON) $(buildscript-dir)/output-distance.py --output-dir $(RESULT_DIR) $(CHECK_SOURCE) input/regression/out-test/
+       $(PYTHON) $(buildscript-dir)/output-distance.py --create-images --output-dir $(RESULT_DIR) $(CHECK_SOURCE) input/regression/out-test/
index 5a83c490d0e4d3d875182e3bde2d4a241c14a1a2..ec8b5d9e10a769f2a907282d9885997a159c7902 100644 (file)
@@ -435,21 +435,50 @@ class SignatureFileLink (FileLink):
 
         self.add_system_link (link, system_index[0])
 
+    
+    def create_images (self, old_dir, new_dir, dest_dir):
+
+        files_created = [[], []]
+        for oldnew in (0, 1):
+            pat = self.base_names[oldnew] + '.eps'
+
+            for f in glob.glob (pat):
+                infile = f
+                outfile = (dest_dir + '/' + f).replace ('.eps', '.png')
+
+                mkdir (os.path.split (outfile)[0])
+                cmd = ('gs -sDEVICE=png16m -dGraphicsAlphaBits=4 -dTextAlphaBits=4 '
+                       ' -r101 '
+                       ' -sOutputFile=%(outfile)s -dNOSAFER -dEPSCrop -q -dNOPAUSE '
+                       ' %(infile)s  -c quit '  % locals ())
+
+                files_created[oldnew].append (outfile)
+                system (cmd)
+
+        return files_created
+    
     def link_files_for_html (self, old_dir, new_dir, dest_dir):
-        png_linked = [[], []]
-        for ext in ('.png', '.ly', '-page*png'):
-            
+        to_compare = [[], []]
+
+        exts = ['.ly']
+        if options.create_images:
+            to_compare = self.create_images (old_dir, new_dir, dest_dir)
+        else:
+            exts += ['.png', '-page*png']
+        
+        for ext in exts:            
             for oldnew in (0,1):
                 for f in glob.glob (self.base_names[oldnew] + ext):
                     dst = dest_dir + '/' + f
                     link_file (f, dst)
 
                     if f.endswith ('.png'):
-                        png_linked[oldnew].append (f)
+                        to_compare[oldnew].append (f)
                         
         if options.compare_images:                
-            for (old,new) in zip (png_linked[0], png_linked[1]):
+            for (old, new) in zip (to_compare[0], to_compare[1]):
                 compare_png_images (old, new, dest_dir)
+
                 
     def html_record_string (self,  old_dir, new_dir):
         def img_cell (ly, img, name):
@@ -467,7 +496,6 @@ class SignatureFileLink (FileLink):
 </font>
 </td>
 ''' % locals ()
-
         def multi_img_cell (ly, imgs, name):
             if not name:
                 name = 'source'
@@ -800,14 +828,15 @@ def test_paired_files ():
 def test_compare_trees ():
     system ('rm -rf dir1 dir2')
     system ('mkdir dir1 dir2')
-    system ('cp 20{-*.signature,.ly,.png} dir1')
-    system ('cp 20{-*.signature,.ly,.png} dir2')
-    system ('cp 20expr{-*.signature,.ly,.png} dir1')
-    system ('cp 19{-*.signature,.ly,.png} dir2/')
-    system ('cp 19{-*.signature,.ly,.png} dir1/')
+    system ('cp 20{-*.signature,.ly,.png,.eps} dir1')
+    system ('cp 20{-*.signature,.ly,.png,.eps} dir2')
+    system ('cp 20expr{-*.signature,.ly,.png,.eps} dir1')
+    system ('cp 19{-*.signature,.ly,.png,.eps} dir2/')
+    system ('cp 19{-*.signature,.ly,.png,.eps} dir1/')
     system ('cp 19-1.signature 19-sub-1.signature')
     system ('cp 19.ly 19-sub.ly')
     system ('cp 19.png 19-sub.png')
+    system ('cp 19.eps 19-sub.eps')
 
     system ('cp 20multipage* dir1')
     system ('cp 20multipage* dir2')
@@ -815,10 +844,10 @@ def test_compare_trees ():
 
     
     system ('mkdir -p dir1/subdir/ dir2/subdir/')
-    system ('cp 19-sub{-*.signature,.ly,.png} dir1/subdir/')
-    system ('cp 19-sub{-*.signature,.ly,.png} dir2/subdir/')
-    system ('cp 20grob{-*.signature,.ly,.png} dir2/')
-    system ('cp 20grob{-*.signature,.ly,.png} dir1/')
+    system ('cp 19-sub{-*.signature,.ly,.png,.eps} dir1/subdir/')
+    system ('cp 19-sub{-*.signature,.ly,.png,.eps} dir2/subdir/')
+    system ('cp 20grob{-*.signature,.ly,.png,.eps} dir2/')
+    system ('cp 20grob{-*.signature,.ly,.png,.eps} dir1/')
 
     ## introduce differences
     system ('cp 19-1.signature dir2/20-1.signature')
@@ -996,6 +1025,12 @@ def main ():
                   action="store_false",
                   help="Don't run graphical comparisons")
 
+    p.add_option ('--create-images',
+                  dest="create_images",
+                  default=False,
+                  action="store_true",
+                  help="Create PNGs from EPSes")
+
     p.add_option ('-o', '--output-dir',
                   dest="output_dir",
                   default=None,
index 89a974879e22128165354704774a373f07ef384a..6a8fcc1963eff910910707d0226c6addcd3dbb12 100644 (file)
@@ -1448,10 +1448,12 @@ def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets):
                             be_verbose=global_options.verbose, 
                             progress_p=1)
 
-    if global_options.format in (HTML, TEXINFO):
+    if global_options.format in (HTML, TEXINFO) and '--formats' not in cmd:
         cmd += ' --formats=png '
-    if global_options.format in (DOCBOOK):
+    elif global_options.format in (DOCBOOK) and '--formats' not in cmd:
         cmd += ' --formats=png,pdf '
+
+        
     # UGH
     # the --process=CMD switch is a bad idea
     # it is too generic for lilypond-book.