summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-12-02 15:14:26 +0000
committerJose Fonseca <jfonseca@vmware.com>2016-12-02 15:14:26 +0000
commit7fed7adabb0219704b28ade49932f7df6c925de0 (patch)
tree59694c8972d02989310683e0385626b134d23e9a
parentf89d3d7dfd0ea5d0bed6cdcb3ef02141a176fcae (diff)
snapdiff: Handle missing images more gracefully.
-rwxr-xr-xscripts/snapdiff.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/snapdiff.py b/scripts/snapdiff.py
index 07aff361..6e596dfd 100755
--- a/scripts/snapdiff.py
+++ b/scripts/snapdiff.py
@@ -241,6 +241,8 @@ def main():
failures += 1
bgcolor = '#ff2020'
else:
+ comparer = None
+ match = None
result = 'MISSING'
failures += 1
bgcolor = '#ff2020'
@@ -250,11 +252,12 @@ def main():
html.write(' <tr>\n')
html.write(' <td bgcolor="%s"><a href="%s">%s<a/></td>\n' % (bgcolor, ref_image, image))
if not match or options.show_all:
- if options.overwrite \
- or not os.path.exists(delta_image) \
- or (os.path.getmtime(delta_image) < os.path.getmtime(ref_image) \
- and os.path.getmtime(delta_image) < os.path.getmtime(src_image)):
- comparer.write_diff(delta_image, fuzz=options.fuzz)
+ if comparer is not None \
+ and (options.overwrite \
+ or not os.path.exists(delta_image) \
+ or (os.path.getmtime(delta_image) < os.path.getmtime(ref_image) \
+ and os.path.getmtime(delta_image) < os.path.getmtime(src_image))):
+ comparer.write_diff(delta_image, fuzz=options.fuzz)
surface(html, ref_image)
surface(html, src_image)
surface(html, delta_image)