Previous 199869 Revisions Next

r23769 Tuesday 18th June, 2013 at 10:42:55 UTC by Oliver Stöneberg
chdtest.py: some cleanup and added support for createld
[src/regtests/chdman]chdtest.py

trunk/src/regtests/chdman/chdtest.py
r23768r23769
5252   for d in dirs:
5353      if d.startswith("."):
5454         continue
55   
55
56      command = ext = d.split("_", 2)[0]         
5657      inFile = os.path.join(root, d, "in")
5758      # TODO: make this better
5859      outFile = os.path.join(root, d, "out.chd").replace("input", "output")
r23768r23769
6566         paramsstr = f.read()
6667         f.close()
6768         params = paramsstr.split(" ")
68      cmd = []
6969      if not os.path.exists(tempFilePath):
7070         os.makedirs(tempFilePath)
71      if d.startswith("createcd"):
71      if command == "createcd":
7272         ext = d.split("_", 2)[1]
7373         inFile += "." + ext
74         cmd = [chdmanBin, "createcd", "-f", "-i", inFile, "-o", tempFile]
75      elif d.startswith("createhd"):
74      elif command == "createhd":
7675         ext = d.split("_", 2)[1]
7776         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":
8381         inFile += ".chd"
84         cmd = [chdmanBin, "copy", "-f", "-i", inFile, "-o", tempFile]
8582      else:
8683         print "unsupported mode"
8784         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
8989      exitcode, stdout, stderr = runProcess(cmd)
9090      if not exitcode == 0:
9191         print d + " - command failed with " + str(exitcode) + " (" + stderr + ")"
r23768r23769
9494      if not exitcode == 0:
9595         print d + " - verify failed with " + str(exitcode) + " (" + stderr + ")"
9696         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
9898      exitcode, info1, stderr = runProcess([chdmanBin, "info", "-v", "-i", tempFile])
9999      if not exitcode == 0:
100100         print d + " - info (temp) failed with " + str(exitcode) + " (" + stderr + ")"

Previous 199869 Revisions Next


© 1997-2024 The MAME Team