]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4364: Allow ImageMagick's compare to exit with status 1
authorDavid Kastrup <dak@gnu.org>
Fri, 1 May 2015 22:35:35 +0000 (00:35 +0200)
committerDavid Kastrup <dak@gnu.org>
Sat, 2 May 2015 00:40:40 +0000 (02:40 +0200)
Apparently Ubuntu 15.04 has a version of "compare" that cannot be easily
persuaded to return anything but exit status 1 (which indicates
dissimilar images but no actual error condition) so we allow this in
script/build/output-distance.py in order to keep "make check" from
failing.

This patch is somewhat artless but does the trick.

scripts/build/output-distance.py

index 569c892a8f63e7754c6b568c81275df7ef6e4e73..49a659b73febd69fff0f79f01b0536b016cf7c1c 100755 (executable)
@@ -89,7 +89,7 @@ def compare_png_images (old, new, dest_dir):
     system ('convert -depth 8 -crop %dx%d+0+0 %s %s/crop1.png' % (dims + (old, dir)))
     system ('convert -depth 8 -crop %dx%d+0+0 %s %s/crop2.png' % (dims + (new, dir)))
 
-    system ('compare -depth 8 -dissimilarity-threshold 1 %(dir)s/crop1.png %(dir)s/crop2.png %(dir)s/diff.png' % locals ())
+    system1 ('compare -depth 8 -dissimilarity-threshold 1 %(dir)s/crop1.png %(dir)s/crop2.png %(dir)s/diff.png' % locals ())
 
     system ("convert  -depth 8 %(dir)s/diff.png -blur 0x3 -negate -channel alpha,blue -type TrueColorMatte -fx 'intensity'    %(dir)s/matte.png" % locals ())
 
@@ -1089,6 +1089,12 @@ def system (x):
     stat = os.system (x)
     assert stat == 0
 
+def system1 (x):
+# Allow exit status 0 and 1
+    print 'invoking', x
+    stat = os.system (x)
+    assert (stat == 0) or (stat == 256) # This return value convention is sick.
+
 
 def test_paired_files ():
     print paired_files (os.environ["HOME"] + "/src/lilypond/scripts/",