From patchwork Wed Aug 12 13:33:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 40874 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 n7CDY2WH021081 for ; Wed, 12 Aug 2009 13:34:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752566AbZHLNdy (ORCPT ); Wed, 12 Aug 2009 09:33:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752523AbZHLNdy (ORCPT ); Wed, 12 Aug 2009 09:33:54 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60809 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbZHLNdx (ORCPT ); Wed, 12 Aug 2009 09:33:53 -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 n7CDXsJw008695 for ; Wed, 12 Aug 2009 09:33:54 -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 n7CDXrgW007143; Wed, 12 Aug 2009 09:33:54 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7CDXqep031023; Wed, 12 Aug 2009 09:33:53 -0400 Received: from balrog.qumranet.com (dhcp-1-27.tlv.redhat.com [10.35.1.27]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 42956250AD6; Wed, 12 Aug 2009 16:33:52 +0300 (IDT) Message-ID: <4A82C4C0.1040605@redhat.com> Date: Wed, 12 Aug 2009 16:33:52 +0300 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 MIME-Version: 1.0 To: Lucas Meneghel Rodrigues CC: Lucas Meneghel Rodrigues , kvm@vger.kernel.org Subject: Re: [PATCH KVM-AUTOTEST 2/2] Convert images to JPEG using PIL instead of an external program References: <1250069685-17727-1-git-send-email-avi@redhat.com> <1250069685-17727-3-git-send-email-avi@redhat.com> <1250081076.2921.2.camel@localhost.localdomain> <4A82BCE6.9050703@redhat.com> <1250083579.2921.36.camel@localhost.localdomain> In-Reply-To: <1250083579.2921.36.camel@localhost.localdomain> 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 On 08/12/2009 04:26 PM, Lucas Meneghel Rodrigues wrote: > But I prefer to follow the project policy when possible. The reason why > I accepted the original code that Michael wrote to perform the > conversion was graceful degradation of functionality (if you don't have > ImageMagick installed, the test will not abort). > Well, policy is policy. See the attached (untested). From 16537ea5270d65837cbd04c13c7289b0714a6d64 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 12 Aug 2009 12:00:52 +0300 Subject: [KVM-AUTOTEST PATCH] Convert images to JPEG using PIL instead of an external program This is faster since we don't need to fork/exec/wait for an external program each time. Signed-off-by: Avi Kivity --- client/tests/kvm/kvm_guest_wizard.py | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/tests/kvm/kvm_guest_wizard.py b/client/tests/kvm/kvm_guest_wizard.py index 73b830e..f3cc482 100644 --- a/client/tests/kvm/kvm_guest_wizard.py +++ b/client/tests/kvm/kvm_guest_wizard.py @@ -110,9 +110,14 @@ def barrier_2(vm, words, params, debug_dir, data_scrdump_filename, history_scrdump_filename = os.path.join(history_dir, "scrdump-step_%s-%s.jpg" % (current_step_num, time.strftime("%Y%m%d-%H%M%S"))) - kvm_subprocess.run_fg("convert -quality 30 %s %s" % - (scrdump_filename, history_scrdump_filename), - logging.debug, "(convert) ", timeout=30) + def convert_image(src, dest): + try: + import PIL.Image + image = PIL.Image.open(src) + image.save(dest, format = 'JPEG', quality = 30) + except: + pass + convert_image(scrdump_filename, history_scrdump_filename) # Compare md5sum of barrier region with the expected md5sum calced_md5sum = ppm_utils.get_region_md5sum(w, h, data, x1, y1, dx, dy, -- 1.6.3.3