From patchwork Fri Apr 3 21:43:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 16239 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n33LhaGX013025 for ; Fri, 3 Apr 2009 21:43:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758071AbZDCVnd (ORCPT ); Fri, 3 Apr 2009 17:43:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757631AbZDCVnc (ORCPT ); Fri, 3 Apr 2009 17:43:32 -0400 Received: from mx2.redhat.com ([66.187.237.31]:55160 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbZDCVnc (ORCPT ); Fri, 3 Apr 2009 17:43:32 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n33LhRKW027385; Fri, 3 Apr 2009 17:43:27 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n33LhSXO032642; Fri, 3 Apr 2009 17:43:28 -0400 Received: from blackpad.localdomain (vpn-10-32.bos.redhat.com [10.16.10.32]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n33LhQ6N005590; Fri, 3 Apr 2009 17:43:26 -0400 Received: by blackpad.localdomain (Postfix, from userid 500) id 72A0367E892; Fri, 3 Apr 2009 18:43:14 -0300 (BRT) Cc: Ryan Harper , "kvm@vger.kernel.org" Subject: [PATCH] kvm-autotest: stepeditor: clear image if width, height, or data are invalid From: Eduardo Habkost To: Uri Lublin References: <20090401155558.GK19400@us.ibm.com> <1238790500-sup-8351@blackpad> In-Reply-To: <1238790500-sup-8351@blackpad> Date: Fri, 03 Apr 2009 18:43:14 -0300 Message-Id: <1238794446-sup-7467@blackpad> User-Agent: Sup/git X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This patch fixes the following issue: Excerpts from Eduardo Habkost's message of Fri Apr 03 17:37:56 -0300 2009: > Excerpts from Ryan Harper's message of Wed Apr 01 12:55:58 -0300 2009: > > Wondering if anyone else using kvm-autotest stepmaker has ever seen this > > error: > > > > Traceback (most recent call last): > > File > > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepmaker. > > py", line 146, in update > > self.set_image_from_file(self.screendump_filename) > > File > > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepeditor > > .py", line 499, in set_image_from_file > > self.set_image(w, h, data) > > File > > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepeditor > > .py", line 485, in set_image > > w, h, w*3)) > > MemoryError > > I've seen this error twice today, while trying to create a step file to > install a Windows 2008 R2 64-bit guest (the Win2008-64 step file > available on the git repository doesn't work for me). This happened when > the guest was being rebooted by the windows installer. The contents of > the screen dump file are this: > > $ cat > /home/ehabkost/autotest/kvm-autotest/client/results/default/kvm_runtest_2.Win200 > 8.64.install/debug/scrdump.ppm > P6 > 0 0 > 255 > $ > > And the 0x0 pixmap really makes gdk panic: > > >>> (w, h, data) = ppm_utils.image_read_from_ppm_file('/home/ehabkost/autotest/kvm-autotest/client/results/default/kvm_runtest_2.Win2008.64.install/debug/scrdump.ppm') > >>> w,h,data > (0, 0, '') > >>> gtk.gdk.pixbuf_new_from_data(data, gtk.gdk.COLORSPACE_RGB, False, 8, w, h, w*3) > Traceback (most recent call last): > File "", line 1, in ? > MemoryError > >>> Signed-off-by: Eduardo Habkost --- client/tests/kvm_runtest_2/stepeditor.py | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/tests/kvm_runtest_2/stepeditor.py b/client/tests/kvm_runtest_2/stepeditor.py index caaf47b..383834b 100755 --- a/client/tests/kvm_runtest_2/stepeditor.py +++ b/client/tests/kvm_runtest_2/stepeditor.py @@ -488,14 +488,18 @@ Utilities vscrollbar = self.scrolledwindow.get_vscrollbar() vscrollbar.set_range(0, h) + def clear_image(self): + self.image.clear() + self.image_width = 0 + self.image_height = 0 + self.image_data = "" + def set_image_from_file(self, filename): if not filename or not os.path.exists(filename): - self.image.clear() - self.image_width = 0 - self.image_height = 0 - self.image_data = "" - return + return self.clear_image() (w, h, data) = ppm_utils.image_read_from_ppm_file(filename) + if w <= 0 or h <= 0 or not data: + return self.clear_image() self.set_image(w, h, data) def get_step_lines(self, output_dir=None, current_step=None):