Previous 199869 Revisions Next

r23794 Wednesday 19th June, 2013 at 14:18:03 UTC by Oliver Stöneberg
chdtest.py:
- fixed check for output folder existence
- clear temp folder before running tests
- log which test failed
[src/regtests/chdman]chdtest.py

trunk/src/regtests/chdman/chdtest.py
r23793r23794
22import subprocess
33import sys
44import hashlib
5import shutil
56
67def runProcess(cmd):
78   process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
r23793r23794
5253   print inputPath + " does not exist"
5354   sys.exit(1)
5455   
55if not os.path.exists(inputPath):
56   print inputPath + " does not exist"
56if not os.path.exists(outputPath):
57   print outputPath + " does not exist"
5758   sys.exit(1)
5859   
59failure = False
60shutil.rmtree(tempPath)
61   
62total_failure = False
6063
6164for root, dirs, files in os.walk(inputPath):
6265   for d in dirs:
6366      if d.startswith("."):
6467         continue
6568
69      failure = False
70
6671      command = ext = d.split("_", 2)[0]         
6772      inFile = os.path.join(root, d, "in")
6873      # TODO: make this better
r23793r23794
96101         cmd = [chdmanBin, command, "-f", "-i", inFile, "-o", tempFile] + params
97102      else:
98103         cmd = [chdmanBin, command, "-f", "-o", tempFile] + params
104
99105      exitcode, stdout, stderr = runProcess(cmd)
100106      if not exitcode == 0:
101107         print d + " - command failed with " + str(exitcode) + " (" + stderr + ")"
102108         failure = True
109     
110      # verify
103111      exitcode, stdout, stderr = runProcess([chdmanBin, "verify", "-i", tempFile])
104112      if not exitcode == 0:
105113         print d + " - verify failed with " + str(exitcode) + " (" + stderr + ")"
106114         failure = True
115         
116      # compare info
107117      # TODO: store expected output of reference file as well and compare
108118      exitcode, info1, stderr = runProcess([chdmanBin, "info", "-v", "-i", tempFile])
109119      if not exitcode == 0:
r23793r23794
123133         failure = True
124134      # TODO: extract and compare
125135
126if not failure:
136      if failure:
137         print d + " failed"
138         total_failure = True
139
140if not total_failure:
127141   print "All tests finished successfully"
No newline at end of file

Previous 199869 Revisions Next


© 1997-2024 The MAME Team