Message ID | 1252519932-30733-19-git-send-email-mgoldish@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Sep 9, 2009 at 3:12 PM, Michael Goldish <mgoldish@redhat.com> wrote: > Passing PIL an invalid PPM file makes it throw an IOError. This one was missing a ppm_utils import. Applied with minimal corrections. > Signed-off-by: Michael Goldish <mgoldish@redhat.com> > --- > Â client/tests/kvm/kvm_preprocessing.py | Â Â 7 ++++--- > Â 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py > index 729e1d4..8809f31 100644 > --- a/client/tests/kvm/kvm_preprocessing.py > +++ b/client/tests/kvm/kvm_preprocessing.py > @@ -273,9 +273,10 @@ def postprocess(test, params, env): > Â Â Â Â Â Â Â Â Â Â Â " files to PNG format...") > Â Â Â Â try: > Â Â Â Â Â Â for f in glob.glob(os.path.join(test.debugdir, "*.ppm")): > - Â Â Â Â Â Â Â Â new_path = f.replace(".ppm", ".png") > - Â Â Â Â Â Â Â Â image = PIL.Image.open(f) > - Â Â Â Â Â Â Â Â image.save(new_path, format = 'PNG') > + Â Â Â Â Â Â Â Â if ppm_utils.image_verify_ppm_file(f): > + Â Â Â Â Â Â Â Â Â Â new_path = f.replace(".ppm", ".png") > + Â Â Â Â Â Â Â Â Â Â image = PIL.Image.open(f) > + Â Â Â Â Â Â Â Â Â Â image.save(new_path, format='PNG') > Â Â Â Â except NameError: > Â Â Â Â Â Â pass > > -- > 1.5.4.1 > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest >
diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py index 729e1d4..8809f31 100644 --- a/client/tests/kvm/kvm_preprocessing.py +++ b/client/tests/kvm/kvm_preprocessing.py @@ -273,9 +273,10 @@ def postprocess(test, params, env): " files to PNG format...") try: for f in glob.glob(os.path.join(test.debugdir, "*.ppm")): - new_path = f.replace(".ppm", ".png") - image = PIL.Image.open(f) - image.save(new_path, format = 'PNG') + if ppm_utils.image_verify_ppm_file(f): + new_path = f.replace(".ppm", ".png") + image = PIL.Image.open(f) + image.save(new_path, format='PNG') except NameError: pass
Passing PIL an invalid PPM file makes it throw an IOError. Signed-off-by: Michael Goldish <mgoldish@redhat.com> --- client/tests/kvm/kvm_preprocessing.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)