Skip to contentSkip to conversation

KVM test: Add new program cd_hash.py

PATCH New Lucas Meneghel Rodrigues 1 participant 1 message Oct 26, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM test: Add new program cd_hash.py

A new program that evaluates hash strings, intended to help kvm autotest administrators was added, cd_hash.

Usage: cd_hash.py [options]

Options:
-h, --help show this help message and exit
-i FILENAME, --iso=FILENAME
path to a ISO file whose hash string will be evaluated.

This script will calculate:

* MD5SUM for the 1st MB of the file
* SHA1SUM for the 1st MB of the file
* MD5SUM for the whole file
* SHA1SUM for the whole file

The hashes for the 1st MB are calculated first in the case the user only wants them. This program replaces calc_md5sum_1m.

---
 client/tests/kvm/calc_md5sum_1m.py |   21 --------------
 client/tests/kvm/cd_hash.py        |   54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 21 deletions(-)
 delete mode 100755 client/tests/kvm/calc_md5sum_1m.py
 create mode 100755 client/tests/kvm/cd_hash.py
client/tests/kvm/calc_md5sum_1m.py deleted +0 -21
deleted file mode 100755
index 153a1e0..0000000
@@ -1,21 +0,0 @@
-#!/usr/bin/python
-"""
-Program that calculates the md5sum for the first megabyte of a file.
-It's faster than calculating the md5sum for the whole ISO image.
-
-@copyright: Red Hat 2008-2009
-@author: Uri Lublin ([email protected])
-"""
-
-import os, sys
-import kvm_utils
-
-
-if len(sys.argv) < 2:
-    print 'usage: %s <iso-filename>' % sys.argv[0]
-else:
-    fname = sys.argv[1]
-    if not os.access(fname, os.F_OK) or not os.access(fname, os.R_OK):
-        print 'bad file name or permissions'
-    else:
-        print kvm_utils.hash_file(fname, 1024*1024, method="md5")
client/tests/kvm/cd_hash.py new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
1.6.2.5