Previous 199869 Revisions Next

r23795 Wednesday 19th June, 2013 at 14:19:09 UTC by Oliver Stöneberg
chdtest.py: added extraction for createcd tests cases (nw)
[src/regtests/chdman]chdtest.py

trunk/src/regtests/chdman/chdtest.py
r23794r23795
3636   f.close()
3737   return sha1.hexdigest()
3838
39def extractcdAndCompare(type):
40   extractFileDir = os.path.join(tempFilePath, type + "_output")
41   if not os.path.exists(extractFileDir):
42      os.makedirs(extractFileDir)
43   extractFileBase = os.path.join(extractFileDir, "extract")
44   extractFile = extractFileBase + "." + type
45   extractFileBin = extractFileBase + ".bin"
46   
47   exitcode, stdout, stderr = runProcess([chdmanBin, "extractcd", "-f", "-i", outFile, "-o", extractFile])
48   if not exitcode == 0:
49      print d + " - extractcd (" + type + ") failed with " + str(exitcode) + " (" + stderr + ")"
50      failure = True
51   
52   sha1_extract = sha1sum(extractFile);
53   sha1_extract_bin = sha1sum(extractFileBin);
54   
55   extractFileDir = os.path.join(tempFilePath, type + "_temp")
56   if not os.path.exists(extractFileDir):
57      os.makedirs(extractFileDir)
58   extractFileBase = os.path.join(extractFileDir, "extract")
59   extractFile = extractFileBase + "." + type
60   extractFileBin = extractFileBase + ".bin"
61   
62   exitcode, stdout, stderr = runProcess([chdmanBin, "extractcd", "-f", "-i", tempFile, "-o", extractFile])
63   if not exitcode == 0:
64      print d + " - extractcd (" + type + ") failed with " + str(exitcode) + " (" + stderr + ")"
65      failure = True
66     
67   sha1_extract_2 = sha1sum(extractFile);
68   sha1_extract_bin_2 = sha1sum(extractFileBin);
69     
70   if not sha1_extract == sha1_extract_2:
71      print "SHA1 mismatch (extractcd - " + type + " - toc) - expected: " + sha1_out + " found: " + sha1_temp
72      failure = True
73
74   if not sha1_extract_bin == sha1_extract_bin_2:
75      print "SHA1 mismatch (extractcd - " + type + " - bin) - expected: " + sha1_out + " found: " + sha1_temp
76      failure = True
77
3978currentDirectory = os.path.dirname(os.path.realpath(__file__))
4079inputPath = os.path.join(currentDirectory, 'input')
4180outputPath = os.path.join(currentDirectory, "output")
r23794r23795
126165      if not compareInfo(info1, info2):
127166         print d + " - info output differs"
128167         failure = True
129      sha1_1 = sha1sum(tempFile)
130      sha1_2 = sha1sum(outFile)
131      if not sha1_1 == sha1_2:
132         print "SHA1 mismatch - expected: " + sha1_2 + " found: " + sha1_1
168         
169      # extract and compare
170      if command == "createcd":
171         extractcdAndCompare("toc")
172         extractcdAndCompare("cue")
173      # TODO: implement extraction for remaining cases
174         
175      # compare SHA1 of output files
176      sha1_out = sha1sum(outFile)
177      sha1_temp = sha1sum(tempFile)
178      if not sha1_out == sha1_temp:
179         print "SHA1 mismatch (output file) - expected: " + sha1_out + " found: " + sha1_temp
133180         failure = True
134      # TODO: extract and compare
135181
136182      if failure:
137183         print d + " failed"

Previous 199869 Revisions Next


© 1997-2024 The MAME Team