[gnome-ostree] smoketest: Be defensive against qemu giving us bad PPM images



commit 03a8f1bcb9ea24ac03e9631aa04b541e3fa23044
Author: Colin Walters <walters verbum org>
Date:   Sun Apr 21 08:43:48 2013 -0400

    smoketest: Be defensive against qemu giving us bad PPM images
    
    (They may not actually be bad; this could be a gdk-pixbuf
     deficiency or qemu could be saving them asynchronously).

 src/js/tasks/task-smoketest.js | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/js/tasks/task-smoketest.js b/src/js/tasks/task-smoketest.js
index a5243e5..4e9e82a 100644
--- a/src/js/tasks/task-smoketest.js
+++ b/src/js/tasks/task-smoketest.js
@@ -195,9 +195,19 @@ const SmoketestOne = new Lang.Class({
         // Convert to PNG if possible
         if (modified && imports.gi.GdkPixbuf) {
             let GdkPixbuf = imports.gi.GdkPixbuf;
-            let pixbuf = GdkPixbuf.Pixbuf.new_from_file(filePath.get_path());
-            let outFilename = this._subworkdir.get_child(filename.replace(/ppm$/, 'png'));
-                    pixbuf.savev(outFilename.get_path(), "png", [], []);
+            let pixbuf;
+            try {
+                pixbuf = GdkPixbuf.Pixbuf.new_from_file(filePath.get_path());
+            } catch (e) {
+                if (e.domain != GdkPixbuf.PixbufError)
+                    throw e;
+                print("Unable to open screenshot ppm: " + e);
+                pixbuf = null;
+            }
+            if (pixbuf) {
+                let outFilename = this._subworkdir.get_child(filename.replace(/ppm$/, 'png'));
+                pixbuf.savev(outFilename.get_path(), "png", [], []);
+            }
             GSystem.file_unlink(filePath, this._cancellable);
         }
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]