3 # Make PNG files from regtests
5 # Usage: ./make-regtest-pngs.sh -j CPUs -o/-n
7 # where -j specifies the number of parallel processes to run
8 # (normally CPUs+1). e.g.:
10 # ./make-regtest-pngs.sh -j9
12 # -o means build an old regtest set - the PNGs go in the old-regtest-results
15 # -n means build a new regtest set - the PNGs go in the new-regtest-results
20 while getopts "j:on" opts; do
21 if [ "$opts" = "j" ]; then
25 if [ "$opts" = "o" ]; then
26 file_loc="old-regtest-results"
29 if [ "$opts" = "n" ]; then
30 file_loc="new-regtest-results"
35 if [ -z "$file_loc" ]; then
36 echo "Must specify old (-o) or new (-n) regtest PNG creation on command line"
40 rm -rf $LILYPOND_BUILD_DIR/out-png-check/$file_loc
41 mkdir -p $LILYPOND_BUILD_DIR/out-png-check/$file_loc
42 cd $LILYPOND_BUILD_DIR/out-png-check/$file_loc
43 ls $LILYPOND_GIT/input/regression/*.ly > dir.txt
44 $LILYPOND_BUILD_DIR/out/bin/lilypond --png --relocate \
45 -dinclude-settings=$LILYPOND_GIT/scripts/auxiliar/NoTagline.ly \
46 -djob-count=$cpu_count -dread-file-list "dir.txt"
50 if [ -n "$do_compare" ]; then
53 mkdir -p regtest-diffs
55 for filename in new-regtest-results/*.png; do
56 trimFile=$(basename $filename)
57 if [ -e old-regtest-results/$trimFile ]; then
58 convert new-regtest-results/$trimFile -level 50% NewTest.png
59 convert old-regtest-results/$trimFile -level 50% OldTest.png
60 difference=$(compare -metric AE NewTest.png OldTest.png null: 2>&1 )
64 if [ $difference -gt 1 ];then
65 echo $trimFile": "$difference" differences"
66 compare -dissimilarity-threshold 1 \
67 new-regtest-results/$trimFile \
68 old-regtest-results/$trimFile regtest-diffs/$trimFile
69 convert regtest-diffs/$trimFile -trim regtest-diffs/$trimFile
70 diff_count=$(($diff_count+1))
73 echo "old-regtest-results/"$trimFile" does not exist"
78 echo $diff_count "differences found."