diff options
-rw-r--r-- | src/regtests/chdman/chdtest.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/regtests/chdman/chdtest.py b/src/regtests/chdman/chdtest.py index 183fcad3698..b4349ce89c0 100644 --- a/src/regtests/chdman/chdtest.py +++ b/src/regtests/chdman/chdtest.py @@ -1,6 +1,7 @@ import os import subprocess import sys +import hashlib def runProcess(cmd): process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -8,8 +9,8 @@ def runProcess(cmd): return process.returncode, stdout, stderr def compareInfo(info1, info2): - lines1 = info1.splitlines(); - lines2 = info2.splitlines(); + lines1 = info1.splitlines() + lines2 = info2.splitlines() if not len(lines1) == len(lines2): return False @@ -25,6 +26,15 @@ def compareInfo(info1, info2): return mismatch == False +def sha1sum(path): + if not os.path.exists(path): + return "" + sha1 = hashlib.sha1() + f = open(path, 'r') + sha1.update(f.read()) + f.close() + return sha1.hexdigest() + currentDirectory = os.path.dirname(os.path.realpath(__file__)) inputPath = os.path.join(currentDirectory, 'input') outputPath = os.path.join(currentDirectory, "output") @@ -106,6 +116,11 @@ for root, dirs, files in os.walk(inputPath): if not compareInfo(info1, info2): print d + " - info output differs" failure = True + sha1_1 = sha1sum(tempFile) + sha1_2 = sha1sum(outFile) + if not sha1_1 == sha1_2: + print "SHA1 mismatch - expected: " + sha1_2 + " found: " + sha1_1 + failure = True # TODO: extract and compare if not failure: |