Message ID | 1238794446-sup-7467@blackpad (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Eduardo Habkost wrote: >>>>> SPACE_RGB, False, 8, w, h, w*3) >>>>> >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> MemoryError >> > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > 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.
On Sun, Apr 05, 2009 at 03:31:03PM +0300, Avi Kivity wrote: > Eduardo Habkost wrote: >>>>>> SPACE_RGB, False, 8, w, h, w*3) >>>>>> >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in ? >>> MemoryError >>> >> >> <snip> >> > > Instead of returning an empty image here, we should throw an exception. > Qemu shouldn't write invalid image. Throwing an exception is exactly what the current code does, and what I want to prevent. stepeditor is a GUI application, there is no point in aborting because the image is invalid during a small time window. But fixing qemu is welcome, of course. > > I've just sent a patch to qemu-devel which may help with this.
Avi Kivity wrote: > Eduardo Habkost wrote: >> >> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> >> --- >> 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. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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):