diff options
author | Oliver Stöneberg <firewave@users.noreply.github.com> | 2013-06-19 14:18:03 +0000 |
---|---|---|
committer | Oliver Stöneberg <firewave@users.noreply.github.com> | 2013-06-19 14:18:03 +0000 |
commit | 286110939dfab0167e514da6ac05e141f0fac31e (patch) | |
tree | ad25fa1da0d72143f87be71271d24c845ccb3e2e /src/regtests | |
parent | 766a73b0418d770a0ce4ea3994ef0451e219c653 (diff) |
chdtest.py:
- fixed check for output folder existence
- clear temp folder before running tests
- log which test failed
Diffstat (limited to 'src/regtests')
-rw-r--r-- | src/regtests/chdman/chdtest.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/regtests/chdman/chdtest.py b/src/regtests/chdman/chdtest.py index b4349ce89c0..af047b1a76a 100644 --- a/src/regtests/chdman/chdtest.py +++ b/src/regtests/chdman/chdtest.py @@ -2,6 +2,7 @@ import os import subprocess import sys import hashlib +import shutil def runProcess(cmd): process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -52,17 +53,21 @@ if not os.path.exists(inputPath): print inputPath + " does not exist" sys.exit(1) -if not os.path.exists(inputPath): - print inputPath + " does not exist" +if not os.path.exists(outputPath): + print outputPath + " does not exist" sys.exit(1) -failure = False +shutil.rmtree(tempPath) + +total_failure = False for root, dirs, files in os.walk(inputPath): for d in dirs: if d.startswith("."): continue + failure = False + command = ext = d.split("_", 2)[0] inFile = os.path.join(root, d, "in") # TODO: make this better @@ -96,14 +101,19 @@ for root, dirs, files in os.walk(inputPath): cmd = [chdmanBin, command, "-f", "-i", inFile, "-o", tempFile] + params else: cmd = [chdmanBin, command, "-f", "-o", tempFile] + params + exitcode, stdout, stderr = runProcess(cmd) if not exitcode == 0: print d + " - command failed with " + str(exitcode) + " (" + stderr + ")" failure = True + + # verify exitcode, stdout, stderr = runProcess([chdmanBin, "verify", "-i", tempFile]) if not exitcode == 0: print d + " - verify failed with " + str(exitcode) + " (" + stderr + ")" failure = True + + # compare info # TODO: store expected output of reference file as well and compare exitcode, info1, stderr = runProcess([chdmanBin, "info", "-v", "-i", tempFile]) if not exitcode == 0: @@ -123,5 +133,9 @@ for root, dirs, files in os.walk(inputPath): failure = True # TODO: extract and compare -if not failure: + if failure: + print d + " failed" + total_failure = True + +if not total_failure: print "All tests finished successfully"
\ No newline at end of file |