From patchwork Sat Mar 20 20:08:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 87187 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2KK8x3q026135 for ; Sat, 20 Mar 2010 20:08:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752150Ab0CTUIi (ORCPT ); Sat, 20 Mar 2010 16:08:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14346 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752057Ab0CTUIh (ORCPT ); Sat, 20 Mar 2010 16:08:37 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2KK8Z6J018720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 20 Mar 2010 16:08:35 -0400 Received: from localhost.localdomain (vpn-10-76.rdu.redhat.com [10.11.10.76]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2KK8Xcd020393; Sat, 20 Mar 2010 16:08:34 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: cd_hash: remove -i command line option Date: Sat, 20 Mar 2010 17:08:31 -0300 Message-Id: <1269115711-5824-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 20 Mar 2010 20:08:59 +0000 (UTC) diff --git a/client/tests/kvm/cd_hash.py b/client/tests/kvm/cd_hash.py index fee20a3..bcd14dc 100755 --- a/client/tests/kvm/cd_hash.py +++ b/client/tests/kvm/cd_hash.py @@ -13,37 +13,36 @@ from autotest_lib.client.bin import utils if __name__ == "__main__": - parser = optparse.OptionParser() - parser.add_option('-i', '--iso', type="string", dest="filename", - action='store', - help='path to a ISO file whose hash string will be ' - 'evaluated.') - + parser = optparse.OptionParser("usage: %prog [options] [filenames]") options, args = parser.parse_args() - filename = options.filename logging_manager.configure_logging(kvm_utils.KvmLoggingConfig()) - if not filename: + if args: + filenames = args + else: parser.print_help() sys.exit(1) - filename = os.path.abspath(filename) - - file_exists = os.path.isfile(filename) - can_read_file = os.access(filename, os.R_OK) - if not file_exists: - logging.critical("File %s does not exist. Aborting...", filename) - sys.exit(1) - if not can_read_file: - logging.critical("File %s does not have read permissions. " - "Aborting...", filename) - sys.exit(1) - - logging.info("Hash values for file %s", os.path.basename(filename)) - logging.info("md5 (1m): %s", utils.hash_file(filename, 1024*1024, - method="md5")) - logging.info("sha1 (1m): %s", utils.hash_file(filename, 1024*1024, - method="sha1")) - logging.info("md5 (full): %s", utils.hash_file(filename, method="md5")) - logging.info("sha1 (full): %s", utils.hash_file(filename, method="sha1")) + for filename in filenames: + filename = os.path.abspath(filename) + + file_exists = os.path.isfile(filename) + can_read_file = os.access(filename, os.R_OK) + if not file_exists: + logging.critical("File %s does not exist!", filename) + continue + if not can_read_file: + logging.critical("File %s does not have read permissions!", + filename) + continue + + logging.info("Hash values for file %s", os.path.basename(filename)) + logging.info("md5 (1m): %s", utils.hash_file(filename, 1024*1024, + method="md5")) + logging.info("sha1 (1m): %s", utils.hash_file(filename, 1024*1024, + method="sha1")) + logging.info("md5 (full): %s", utils.hash_file(filename, method="md5")) + logging.info("sha1 (full): %s", utils.hash_file(filename, + method="sha1")) + logging.info("")