diff options
-rw-r--r-- | .gitattributes | 5 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | makefile | 6 | ||||
-rw-r--r-- | src/regtests/chdman/chdtest.py | 91 | ||||
-rw-r--r-- | src/regtests/chdman/input/createcd_cue_empty/in.bin | bin | 0 -> 1245184 bytes | |||
-rw-r--r-- | src/regtests/chdman/input/createcd_cue_empty/in.cue | 3 | ||||
-rw-r--r-- | src/regtests/chdman/input/createcd_iso_empty/in.iso | bin | 0 -> 1245184 bytes | |||
-rw-r--r-- | src/regtests/chdman/output/createcd_cue_empty/out.chd | bin | 0 -> 2279 bytes | |||
-rw-r--r-- | src/regtests/chdman/output/createcd_iso_empty/out.chd | bin | 0 -> 2017 bytes |
9 files changed, 103 insertions, 3 deletions
diff --git a/.gitattributes b/.gitattributes index 104041b7a07..47730c16473 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8041,6 +8041,11 @@ src/osd/windows/winutil.c svneol=native#text/plain src/osd/windows/winutil.h svneol=native#text/plain src/osd/windows/winwork.c svneol=native#text/plain src/regtests/chdman/chdtest.py svneol=native#text/plain +src/regtests/chdman/input/createcd_cue_empty/in.bin -text +src/regtests/chdman/input/createcd_cue_empty/in.cue svneol=native#text/plain +src/regtests/chdman/input/createcd_iso_empty/in.iso -text +src/regtests/chdman/output/createcd_cue_empty/out.chd -text +src/regtests/chdman/output/createcd_iso_empty/out.chd -text src/regtests/jedutil/baseline/18cv8/18cv8_combinatorial_feedback.txt svneol=native#text/plain src/regtests/jedutil/baseline/18cv8/18cv8_register_feedback.txt svneol=native#text/plain src/regtests/jedutil/baseline/18cv8/pal10h8-to-peel18cv8.txt svneol=native#text/plain diff --git a/.gitignore b/.gitignore index 714704c2d40..15896ae947e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +src/regtests/chdman/temp src/regtests/jedutil/output @@ -684,11 +684,11 @@ default: maketree buildtools emulator all: default tools # TODO: move to a .mak file in the regtests folder? -tests: default tools +tests: tools @echo Running jedutil unittest $(PYTHON) src/regtests/jedutil/jedtest.py - #@echo Running chdman unittest - #$(PYTHON) src/regtests/chdman/chdtest.py + @echo Running chdman unittest + $(PYTHON) src/regtests/chdman/chdtest.py 7Z_LIB = $(OBJ)/lib7z.a diff --git a/src/regtests/chdman/chdtest.py b/src/regtests/chdman/chdtest.py index e69de29bb2d..cd68f842e9c 100644 --- a/src/regtests/chdman/chdtest.py +++ b/src/regtests/chdman/chdtest.py @@ -0,0 +1,91 @@ +import os +import subprocess +import sys + +def runProcess(cmd): + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = process.communicate() + return process.returncode, stdout, stderr + +def compareInfo(info1, info2): + lines1 = info1.splitlines(); + lines2 = info2.splitlines(); + if not len(lines1) == len(lines2): + return False + + mismatch = False + for i in range(len(lines1)): + if lines1[i].startswith("chdman - ") and lines2[i].startswith("chdman - "): + continue + if lines1[i].startswith("Input file:") and lines2[i].startswith("Input file:"): + continue + if not lines1[i] == lines2[i]: + mismatch = True + print lines1[i] + " - " + lines2[i] + + return mismatch == False + +currentDirectory = os.path.dirname(os.path.realpath(__file__)) +inputPath = os.path.join(currentDirectory, 'input') +outputPath = os.path.join(currentDirectory, "output") +tempPath = os.path.join(currentDirectory, "temp") +if os.name == 'nt': + chdmanBin = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "chdman.exe")) +else: + chdmanBin = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "chdman")) + +if not os.path.exists(chdmanBin): + print chdmanBin + " does not exist" + sys.exit(1) + +if not os.path.exists(inputPath): + print inputPath + " does not exist" + sys.exit(1) + +if not os.path.exists(inputPath): + print inputPath + " does not exist" + sys.exit(1) + +failure = False + +for root, dirs, files in os.walk(inputPath): + for d in dirs: + inFile = os.path.join(root, d, "in") + # TODO: make this better + outFile = os.path.join(root, d, "out.chd").replace("input", "output") + tempFilePath = os.path.join(tempPath, d) + tempFile = os.path.join(tempFilePath, "out.chd") + cmd = "" + if not os.path.exists(tempFilePath): + os.makedirs(tempFilePath) + if d.startswith("createcd"): + ext = d.split("_", 2)[1] + inFile += "." + ext + cmd = chdmanBin + " createcd -f -i " + inFile + " -o " + tempFile + else: + print "unsupported mode" + continue + exitcode, stdout, stderr = runProcess(cmd) + if not exitcode == 0: + print d + " - command failed with " + str(exitcode) + " (" + stderr + ")" + failure = True + exitcode, stdout, stderr = runProcess(chdmanBin + " verify -i " + tempFile) + if not exitcode == 0: + print d + " - verify failed with " + str(exitcode) + " (" + stderr + ")" + failure = True + # TODO: store exected output of reference file as well and compare + exitcode, info1, stderr = runProcess(chdmanBin + " info -v -i " + tempFile) + if not exitcode == 0: + print d + " - info (temp) failed with " + str(exitcode) + " (" + stderr + ")" + failure = True + exitcode, info2, stderr = runProcess(chdmanBin + " info -v -i " + outFile) + if not exitcode == 0: + print d + " - info (output) failed with " + str(exitcode) + " (" + stderr + ")" + failure = True + if not compareInfo(info1, info2): + print d + " - info output differs" + failure = True + # TODO: extract and compare + +if not failure: + print "All tests finished successfully"
\ No newline at end of file diff --git a/src/regtests/chdman/input/createcd_cue_empty/in.bin b/src/regtests/chdman/input/createcd_cue_empty/in.bin Binary files differnew file mode 100644 index 00000000000..0eb74d2e77a --- /dev/null +++ b/src/regtests/chdman/input/createcd_cue_empty/in.bin diff --git a/src/regtests/chdman/input/createcd_cue_empty/in.cue b/src/regtests/chdman/input/createcd_cue_empty/in.cue new file mode 100644 index 00000000000..ad7dcbb209b --- /dev/null +++ b/src/regtests/chdman/input/createcd_cue_empty/in.cue @@ -0,0 +1,3 @@ +FILE "in.bin" BINARY + TRACK 01 MODE1/2352 + INDEX 01 00:00:00
\ No newline at end of file diff --git a/src/regtests/chdman/input/createcd_iso_empty/in.iso b/src/regtests/chdman/input/createcd_iso_empty/in.iso Binary files differnew file mode 100644 index 00000000000..af40397d87a --- /dev/null +++ b/src/regtests/chdman/input/createcd_iso_empty/in.iso diff --git a/src/regtests/chdman/output/createcd_cue_empty/out.chd b/src/regtests/chdman/output/createcd_cue_empty/out.chd Binary files differnew file mode 100644 index 00000000000..8871f29e984 --- /dev/null +++ b/src/regtests/chdman/output/createcd_cue_empty/out.chd diff --git a/src/regtests/chdman/output/createcd_iso_empty/out.chd b/src/regtests/chdman/output/createcd_iso_empty/out.chd Binary files differnew file mode 100644 index 00000000000..a6b8d38890e --- /dev/null +++ b/src/regtests/chdman/output/createcd_iso_empty/out.chd |