Previous 199869 Revisions Next

r23796 Wednesday 19th June, 2013 at 14:29:56 UTC by Oliver Stöneberg
chdtest.py: added remaining extractions (nw)
[src/regtests/chdman]chdtest.py

trunk/src/regtests/chdman/chdtest.py
r23795r23796
7474   if not sha1_extract_bin == sha1_extract_bin_2:
7575      print "SHA1 mismatch (extractcd - " + type + " - bin) - expected: " + sha1_out + " found: " + sha1_temp
7676      failure = True
77     
78def extractAndCompare(command, ext):
79   extractFileDir = os.path.join(tempFilePath, ext + "_output")
80   if not os.path.exists(extractFileDir):
81      os.makedirs(extractFileDir)
82   extractFileBase = os.path.join(extractFileDir, "extract")
83   extractFile = extractFileBase + "." + ext
84   
85   exitcode, stdout, stderr = runProcess([chdmanBin, command, "-f", "-i", outFile, "-o", extractFile])
86   if not exitcode == 0:
87      print d + " - " + command + " (" + ext + ") failed with " + str(exitcode) + " (" + stderr + ")"
88      failure = True
89   
90   sha1_extract = sha1sum(extractFile);
91   
92   extractFileDir = os.path.join(tempFilePath, ext + "_temp")
93   if not os.path.exists(extractFileDir):
94      os.makedirs(extractFileDir)
95   extractFileBase = os.path.join(extractFileDir, "extract")
96   extractFile = extractFileBase + "." + ext
97   
98   exitcode, stdout, stderr = runProcess([chdmanBin, command, "-f", "-i", tempFile, "-o", extractFile])
99   if not exitcode == 0:
100      print d + " - " + command + " (" + ext + ") failed with " + str(exitcode) + " (" + stderr + ")"
101      failure = True
102     
103   sha1_extract_2 = sha1sum(extractFile);
104     
105   if not sha1_extract == sha1_extract_2:
106      print "SHA1 mismatch (" + command + " - " + ext + ") - expected: " + sha1_out + " found: " + sha1_temp
107      failure = True
77108
78109currentDirectory = os.path.dirname(os.path.realpath(__file__))
79110inputPath = os.path.join(currentDirectory, 'input')
r23795r23796
170201      if command == "createcd":
171202         extractcdAndCompare("toc")
172203         extractcdAndCompare("cue")
173      # TODO: implement extraction for remaining cases
204      elif command == "createhd":
205         extractAndCompare("extracthd", "raw")
206      elif command == "createld":
207         extractAndCompare("extractld", "avi")
174208         
175209      # compare SHA1 of output files
176210      sha1_out = sha1sum(outFile)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team