From: Phil Holmes Date: Sat, 23 Mar 2013 15:40:40 +0000 (+0000) Subject: Script for running pixel-based regtest comparisons X-Git-Tag: release/2.17.15-1~17^2~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b4fe233aec83383bd2e6b6170fca67a31a8c492d;hp=cb33ef7d9c1ec1976ab207ddf1c1d8ba711e53b2;p=lilypond.git Script for running pixel-based regtest comparisons --- diff --git a/scripts/auxiliar/NoTagline.ly b/scripts/auxiliar/NoTagline.ly new file mode 100644 index 0000000000..84392737a8 --- /dev/null +++ b/scripts/auxiliar/NoTagline.ly @@ -0,0 +1,4 @@ +\paper { + #(set-paper-size "A4") +} +\header { tagline = ##f } diff --git a/scripts/auxiliar/make-regtest-pngs.sh b/scripts/auxiliar/make-regtest-pngs.sh new file mode 100755 index 0000000000..5942e279da --- /dev/null +++ b/scripts/auxiliar/make-regtest-pngs.sh @@ -0,0 +1,79 @@ +#!/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