]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3377: Let scripts/auxiliar/make-regtest-pngs.sh take an optional file list
authorDavid Kastrup <dak@gnu.org>
Fri, 24 May 2013 12:14:49 +0000 (14:14 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 24 May 2013 12:47:16 +0000 (14:47 +0200)
This makes it much faster to just compare selected regtests.

scripts/auxiliar/make-regtest-pngs.sh

index 659987ba12708123d8ea35545d3e6048bdc2cb2f..01610e8ac34d5376155b49abeeeb8735969195d9 100755 (executable)
@@ -34,6 +34,9 @@
 #
 #   -d changes the Ghostscript device used for creating PNG files
 #   (usually png16m for direct PNG creation and pngmono for printer simulation)
+#
+#   if any filenames follow, those are the tests to run.  In absence
+#   of any filenames, the contents of input/regression are used.
 
 cpu_count=${CPU_COUNT:-1}
 backend_opt='--png ${resolution:+=-dresolution=$resolution} ${gsdevice:+=-dpixmap-format=$gsdevice}'
@@ -77,6 +80,8 @@ while getopts "j:oncr:gpd:" opts; do
     esac
 done
 
+shift $((OPTIND-1))
+
 if [ -z "$file_loc" ]; then
     echo "Must specify old (-o) or new (-n) regtest PNG creation on command line"
     exit 1
@@ -84,8 +89,23 @@ fi
 
 rm -rf $LILYPOND_BUILD_DIR/out-png-check/$file_loc
 mkdir -p $LILYPOND_BUILD_DIR/out-png-check/$file_loc
+OLDPWD="$PWD"
 cd $LILYPOND_BUILD_DIR/out-png-check/$file_loc
-ls $LILYPOND_GIT/input/regression/*.ly > dir.txt
+if [ "$*" = "" ]
+then
+    ls $LILYPOND_GIT/input/regression/*.ly > dir.txt
+else
+    : > dir.txt
+    for i
+    do
+       case "$i" in /*)
+               echo "$i" >> dir.txt;;
+           *)
+               echo "$OLDPWD/$i" >> dir.txt
+       esac
+    done
+fi
+
 $LILYPOND_BUILD_DIR/out/bin/lilypond $(eval echo $backend_opt) --relocate \
     -dinclude-settings=$LILYPOND_GIT/scripts/auxiliar/NoTagline.ly \
     -djob-count=$cpu_count -dread-file-list "dir.txt"
@@ -115,7 +135,7 @@ if [ -n "$do_compare" ]; then
     diff_count=0
     for filename in new-regtest-results/*.png; do
         trimFile=$(basename $filename)
-        if [ -e old-regtest-results/$trimFile ]; then
+        if [ -e "old-regtest-results/$trimFile" ]; then
             convert new-regtest-results/$trimFile -level 50%  NewTest.png
             convert old-regtest-results/$trimFile -level 50%  OldTest.png
             difference=$(compare -metric AE NewTest.png OldTest.png null: 2>&1 )