diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-12-02 15:14:26 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-12-02 15:14:26 +0000 |
commit | 7fed7adabb0219704b28ade49932f7df6c925de0 (patch) | |
tree | 59694c8972d02989310683e0385626b134d23e9a /scripts | |
parent | f89d3d7dfd0ea5d0bed6cdcb3ef02141a176fcae (diff) |
snapdiff: Handle missing images more gracefully.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/snapdiff.py | 13 |
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) |