diff options
author | Jose <jose@zeroc.com> | 2018-03-22 22:18:49 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-03-22 22:18:49 +0100 |
commit | 7f365ed8bb427b69c7fe676ce57592e3b3345a40 (patch) | |
tree | 77ccb50bcc657676743549a11bbf066996e0792d /cpp/test/Slice/errorDetection/test.py | |
parent | Update to use NuGet 4.6 with Windows MSBuild builds (diff) | |
download | ice-7f365ed8bb427b69c7fe676ce57592e3b3345a40.tar.bz2 ice-7f365ed8bb427b69c7fe676ce57592e3b3345a40.tar.xz ice-7f365ed8bb427b69c7fe676ce57592e3b3345a40.zip |
Remove Slice/errorDetection generated files
See ICE-8759
Diffstat (limited to 'cpp/test/Slice/errorDetection/test.py')
-rw-r--r-- | cpp/test/Slice/errorDetection/test.py | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/cpp/test/Slice/errorDetection/test.py b/cpp/test/Slice/errorDetection/test.py index 485ae4b4493..fd416417eda 100644 --- a/cpp/test/Slice/errorDetection/test.py +++ b/cpp/test/Slice/errorDetection/test.py @@ -18,32 +18,36 @@ class SliceErrorDetectionTestCase(ClientTestCase): files = glob.glob("{0}/*.ice".format(testdir)) files.sort() - for file in files: - current.write(os.path.basename(file) + "... ") - - args = ["-I.", file, "--output-dir", "tmp"] - if file.find("Underscore") >= 0: - args.append("--underscore") - - # Don't print out slice2cpp output and expect failures - slice2cpp.run(current, args=args, exitstatus=0 if file.find("Warning") >= 0 else 1) - output = slice2cpp.getOutput(current) - - regex1 = re.compile("\.ice$", re.IGNORECASE) - lines1 = output.strip().splitlines() - lines2 = open(os.path.join(testdir, regex1.sub(".err", file)), "r").readlines() - if len(lines1) != len(lines2): - raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2))) - - regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")") - i = 0 - while i < len(lines1): - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() - if line1 != line2: - raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2)) - i = i + 1 - else: - current.writeln("ok") + try: + for file in files: + current.write(os.path.basename(file) + "... ") + + args = ["-I.", file, "--output-dir", "tmp"] + if file.find("Underscore") >= 0: + args.append("--underscore") + + # Don't print out slice2cpp output and expect failures + slice2cpp.run(current, args=args, exitstatus=0 if file.find("Warning") >= 0 else 1) + output = slice2cpp.getOutput(current) + + regex1 = re.compile("\.ice$", re.IGNORECASE) + lines1 = output.strip().splitlines() + lines2 = open(os.path.join(testdir, regex1.sub(".err", file)), "r").readlines() + if len(lines1) != len(lines2): + raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2))) + + regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")") + i = 0 + while i < len(lines1): + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + if line1 != line2: + raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2)) + i = i + 1 + else: + current.writeln("ok") + finally: + for file in glob.glob("{0}/tmp/*".format(testdir)): + current.files.append(file) TestSuite(__name__, [ SliceErrorDetectionTestCase() ]) |