trunk/src/regtests/chdman/chdtest.py
| r23768 | r23769 | |
| 52 | 52 | for d in dirs: |
| 53 | 53 | if d.startswith("."): |
| 54 | 54 | continue |
| 55 | | |
| 55 | |
| 56 | command = ext = d.split("_", 2)[0] |
| 56 | 57 | inFile = os.path.join(root, d, "in") |
| 57 | 58 | # TODO: make this better |
| 58 | 59 | outFile = os.path.join(root, d, "out.chd").replace("input", "output") |
| r23768 | r23769 | |
| 65 | 66 | paramsstr = f.read() |
| 66 | 67 | f.close() |
| 67 | 68 | params = paramsstr.split(" ") |
| 68 | | cmd = [] |
| 69 | 69 | if not os.path.exists(tempFilePath): |
| 70 | 70 | os.makedirs(tempFilePath) |
| 71 | | if d.startswith("createcd"): |
| 71 | if command == "createcd": |
| 72 | 72 | ext = d.split("_", 2)[1] |
| 73 | 73 | inFile += "." + ext |
| 74 | | cmd = [chdmanBin, "createcd", "-f", "-i", inFile, "-o", tempFile] |
| 75 | | elif d.startswith("createhd"): |
| 74 | elif command == "createhd": |
| 76 | 75 | ext = d.split("_", 2)[1] |
| 77 | 76 | inFile += "." + ext |
| 78 | | if os.path.exists(inFile): |
| 79 | | cmd = [chdmanBin, "createhd", "-f", "-i", inFile, "-o", tempFile] |
| 80 | | else: |
| 81 | | cmd = [chdmanBin, "createhd", "-f", "-o", tempFile] |
| 82 | | elif d.startswith("copy"): |
| 77 | elif command == "createld": |
| 78 | ext = d.split("_", 2)[1] |
| 79 | inFile += "." + ext |
| 80 | elif command == "copy": |
| 83 | 81 | inFile += ".chd" |
| 84 | | cmd = [chdmanBin, "copy", "-f", "-i", inFile, "-o", tempFile] |
| 85 | 82 | else: |
| 86 | 83 | print "unsupported mode" |
| 87 | 84 | continue |
| 88 | | cmd += params |
| 85 | if os.path.exists(inFile): |
| 86 | cmd = [chdmanBin, command, "-f", "-i", inFile, "-o", tempFile] + params |
| 87 | else: |
| 88 | cmd = [chdmanBin, command, "-f", "-o", tempFile] + params |
| 89 | 89 | exitcode, stdout, stderr = runProcess(cmd) |
| 90 | 90 | if not exitcode == 0: |
| 91 | 91 | print d + " - command failed with " + str(exitcode) + " (" + stderr + ")" |
| r23768 | r23769 | |
| 94 | 94 | if not exitcode == 0: |
| 95 | 95 | print d + " - verify failed with " + str(exitcode) + " (" + stderr + ")" |
| 96 | 96 | failure = True |
| 97 | | # TODO: store exected output of reference file as well and compare |
| 97 | # TODO: store expected output of reference file as well and compare |
| 98 | 98 | exitcode, info1, stderr = runProcess([chdmanBin, "info", "-v", "-i", tempFile]) |
| 99 | 99 | if not exitcode == 0: |
| 100 | 100 | print d + " - info (temp) failed with " + str(exitcode) + " (" + stderr + ")" |