From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uri Lublin Subject: Re: [PATCH] kvm-autotest: stepeditor: clear image if width, height, or data are invalid Date: Sun, 05 Apr 2009 20:33:50 +0300 Message-ID: <49D8EB7E.1020900@redhat.com> References: <20090401155558.GK19400@us.ibm.com> <1238790500-sup-8351@blackpad> <1238794446-sup-7467@blackpad> <49D8A487.9060803@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Eduardo Habkost , Ryan Harper To: "kvm@vger.kernel.org" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:42507 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbZDERdy (ORCPT ); Sun, 5 Apr 2009 13:33:54 -0400 In-Reply-To: <49D8A487.9060803@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > Eduardo Habkost wrote: >> >> 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) >> > > Instead of returning an empty image here, we should throw an exception. > Qemu shouldn't write invalid image. > > I've just sent a patch to qemu-devel which may help with this. > I'm going to accept this patch. For step-maker and step-editor, I think we should let the user finish creating/editing the step-file (see Ryan's comment about wasting time). For guest-installation test (kvm-guest-wizard), I agree that we should fail the test, and not ignore the error. Thanks, Uri.