Reviewers: ,

Message:
Please review.

Description:
I think this is reasonably self explanatory.  Running the script with -o
-j9 will create a set of "old" images in build/out-png-check.  Make
changes to lily, compile and run the script -n -jX and you'll be told
which images are different, and a set of image differences will be in
regtest-diffs.

Please review.

I'm aware that this will require updates to the CG, but think those
should come after this is accepted.

Please review this at https://codereview.appspot.com/7578046/

Affected files:
  A scripts/auxiliar/NoTagline.ly
  A scripts/auxiliar/make-regtest-pngs.sh


Index: scripts/auxiliar/NoTagline.ly
diff --git a/scripts/auxiliar/NoTagline.ly b/scripts/auxiliar/NoTagline.ly
new file mode 100644
index 0000000000000000000000000000000000000000..84392737a8bb20b4a5451abea673ff22e3696061
--- /dev/null
+++ b/scripts/auxiliar/NoTagline.ly
@@ -0,0 +1,4 @@
+\paper {
+  #(set-paper-size "A4")
+}
+\header { tagline = ##f }
Index: scripts/auxiliar/make-regtest-pngs.sh
diff --git a/scripts/auxiliar/make-regtest-pngs.sh b/scripts/auxiliar/make-regtest-pngs.sh
new file mode 100755
index 0000000000000000000000000000000000000000..bfa713ccb2d2ea29999058797229408e42c6c7df
--- /dev/null
+++ b/scripts/auxiliar/make-regtest-pngs.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+#  Make PNG files from regtests
+#
+#  Usage:  ./make-regtest-pngs.sh -j CPUs -o/-n
+#
+#    where -j specifies the number of parallel processes to run
+#    (normally CPUs+1).  e.g.:
+#
+#    ./make-regtest-pngs.sh -j9
+#
+# -o means build an old regtest set - the PNGs go in the old-regtest-results
+#   directory
+#
+# -n means build a new regtest set - the PNGs go in the new-regtest-results
+#   directory
+
+cpu_count=1
+
+while getopts "j:on" opts; do
+    if [ "$opts" = "j" ]; then
+        cpu_count=$OPTARG
+    fi
+
+    if [ "$opts" = "o" ]; then
+        file_loc="old-regtest-results"
+    fi
+
+    if [ "$opts" = "n" ]; then
+        file_loc="new-regtest-results"
+        do_compare="y"
+    fi
+done
+
+if [ -z "$file_loc" ]; then
+ echo "Must specify old (-o) or new (-n) regtest PNG creation on command line"
+    exit 1
+fi
+
+rm -rf $LILYPOND_BUILD_DIR/out-png-check/$file_loc
+mkdir -p $LILYPOND_BUILD_DIR/out-png-check/$file_loc
+cd $LILYPOND_BUILD_DIR/out-png-check/$file_loc
+ls $LILYPOND_GIT/input/regression/*.ly > dir.txt
+$LILYPOND_BUILD_DIR/out/bin/lilypond --png --relocate -dinclude-settings=$LILYPOND_GIT/scripts/auxiliar/NoTagline.ly -djob-count=$cpu_count -dread-file-list "dir.txt"
+rm -rf dir.txt
+rm -rf *.log
+
+if [ -n "$do_compare" ]; then
+    cd ..
+    rm -rf regtest-diffs
+    mkdir -p regtest-diffs
+    diff_count=0
+    for filename in new-regtest-results/*.png; do
+        trimFile=$(basename $filename)
+        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 )
+            if [ $? -gt 0 ];then
+                difference=9999
+            fi
+            if [ $difference -gt 1 ];then
+                echo $trimFile": "$difference" differences"
+ compare -dissimilarity-threshold 1 new-regtest-results/$trimFile old-regtest-results/$trimFile regtest-diffs/$trimFile + convert regtest-diffs/$trimFile -trim regtest-diffs/$trimFile
+                diff_count=$(($diff_count+1))
+            fi
+        else
+            echo "old-regtest-results/"$trimFile" does not exist"
+        fi
+    done
+    rm -rf NewTest.png
+    rm -rf OldTest.png
+    echo $diff_count "differences found."
+fi



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to