From patchwork Wed Oct 21 21:31:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 55224 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 n9LLWXVp030880 for ; Wed, 21 Oct 2009 21:32:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755494AbZJUVbz (ORCPT ); Wed, 21 Oct 2009 17:31:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755409AbZJUVby (ORCPT ); Wed, 21 Oct 2009 17:31:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49192 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755445AbZJUVbx (ORCPT ); Wed, 21 Oct 2009 17:31:53 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9LLVvcn023745; Wed, 21 Oct 2009 17:31:57 -0400 Received: from localhost.localdomain (vpn-12-234.rdu.redhat.com [10.11.12.234]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9LLVoHW004876; Wed, 21 Oct 2009 17:31:55 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, jburke@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH 3/3] KVM test: Extend VM.create() method to support SHA1 check Date: Wed, 21 Oct 2009 19:31:47 -0200 Message-Id: <1256160707-4333-3-git-send-email-lmr@redhat.com> In-Reply-To: <1256160707-4333-2-git-send-email-lmr@redhat.com> References: <1256160707-4333-1-git-send-email-lmr@redhat.com> <1256160707-4333-2-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index a8d96ca..3d604c4 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -339,20 +339,27 @@ class VM: if params.get("md5sum_1m"): logging.debug("Comparing expected MD5 sum with MD5 sum of " "first MB of ISO file...") - actual_md5sum = kvm_utils.md5sum_file(iso, 1048576) - expected_md5sum = params.get("md5sum_1m") + actual_hash = kvm_utils.md5sum_file(iso, 1048576) + expected_hash = params.get("md5sum_1m") compare = True elif params.get("md5sum"): logging.debug("Comparing expected MD5 sum with MD5 sum of ISO " "file...") - actual_md5sum = kvm_utils.md5sum_file(iso) - expected_md5sum = params.get("md5sum") + actual_hash = kvm_utils.md5sum_file(iso) + expected_hash = params.get("md5sum") + compare = True + elif params.get("sha1sum"): + logging.debug("Comparing expected SHA1 sum with SHA1 sum of " + "ISO file...") + actual_hash = kvm_utils.md5sum_file(iso) + expected_hash = params.get("md5sum") compare = True if compare: - if actual_md5sum == expected_md5sum: - logging.debug("MD5 sums match") + if actual_hash == expected_hash: + logging.debug("Hashes match") else: - logging.error("Actual MD5 sum differs from expected one") + logging.error("Actual hash %s differs from expected " + "one %s", actual_hash, expected_hash) return False # Make sure the following code is not executed by more than one thread