trunk/src/regtests/jedutil/jedtest.py
| r244809 | r244810 | |
| 58 | 58 | for test in tests: |
| 59 | 59 | command = [jedUtilApp, "-view", test.jedFile, test.name] |
| 60 | 60 | if VERBOSE: |
| 61 | | print "Viewing the JED file: %s" % test.jedFile |
| 62 | | print "Command: %s" % " ".join(command) |
| 61 | print("Viewing the JED file: %s" % test.jedFile) |
| 62 | print("Command: %s" % " ".join(command)) |
| 63 | 63 | |
| 64 | 64 | process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 65 | 65 | (stdout,stderr) = process.communicate() |
| 66 | 66 | |
| 67 | 67 | if stderr: |
| 68 | | print "Error: JED test named " + test.name + " failed during viewing (" + stderr.strip() + ")." |
| 68 | print("Error: JED test named " + test.name + " failed during viewing (" + stderr.decode('latin-1').strip() + ").") |
| 69 | 69 | |
| 70 | 70 | fp = open(test.outputFile, "wb") |
| 71 | 71 | fp.write(stdout) |
| r244809 | r244810 | |
| 85 | 85 | jedUtilApp = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "jedutil")) |
| 86 | 86 | |
| 87 | 87 | if VERBOSE: |
| 88 | | print "JED Path: %s" % jedsPath |
| 89 | | print "Baseline Path: %s" % baselinePath |
| 90 | | print "Output Path: %s" % outputPath |
| 91 | | print "jedutil App: %s" % jedUtilApp |
| 92 | | print |
| 88 | print("JED Path: %s" % jedsPath) |
| 89 | print("Baseline Path: %s" % baselinePath) |
| 90 | print("Output Path: %s" % outputPath) |
| 91 | print("jedutil App: %s" % jedUtilApp) |
| 92 | print('') |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | # Insure everything exists |
| r244809 | r244810 | |
| 97 | 97 | not os.path.exists(jedsPath) or |
| 98 | 98 | not os.path.exists(baselinePath) or |
| 99 | 99 | not os.path.exists(jedUtilApp)): |
| 100 | | print "One of the above paths does not exist. Aborting. %s" % jedUtilApp |
| 100 | print("One of the above paths does not exist. Aborting. %s" % jedUtilApp) |
| 101 | 101 | return 3 |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | # Gather the tests |
| 105 | 105 | tests = findJedTests(jedsPath, baselinePath, outputPath) |
| 106 | 106 | if not len(tests): |
| 107 | | print "No tests found!" |
| 107 | print("No tests found!") |
| 108 | 108 | return 2 |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | # Setup the output paths |
| 112 | 112 | if VERBOSE: |
| 113 | | print "Cleaning the output directory" |
| 114 | | print |
| 113 | print("Cleaning the output directory") |
| 114 | print('') |
| 115 | 115 | if os.path.exists(outputPath): |
| 116 | 116 | shutil.rmtree(outputPath) |
| 117 | 117 | os.makedirs(outputPath) |
| r244809 | r244810 | |
| 129 | 129 | success = True |
| 130 | 130 | for test in tests: |
| 131 | 131 | if VERBOSE: |
| 132 | | print "Diffing the output from viewing the JED file: %s" % os.path.basename(test.jedFile) |
| 132 | print("Diffing the output from viewing the JED file: %s" % os.path.basename(test.jedFile)) |
| 133 | 133 | if not filecmp.cmp(test.outputFile, test.baselineFile): |
| 134 | 134 | success = False |
| 135 | | print "Test %s failed" % os.path.basename(test.jedFile) |
| 135 | print("Test %s failed" % os.path.basename(test.jedFile)) |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | # Report |
| 139 | 139 | if success: |
| 140 | | print "All tests ran successfully." |
| 140 | print("All tests ran successfully.") |
| 141 | 141 | return 0 |
| 142 | 142 | |
| 143 | 143 | |