diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
commit | 943a48fc5c0a59b892eb746073c71b8dd88815e7 (patch) | |
tree | 421cfedbc60603d02e0b314d9204e9f85dd781c5 /cpp/test/Slice/errorDetection/run.py | |
parent | minor fix to IcePHP getLogger (diff) | |
download | ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.bz2 ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.xz ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.zip |
python 3 support
Diffstat (limited to 'cpp/test/Slice/errorDetection/run.py')
-rwxr-xr-x | cpp/test/Slice/errorDetection/run.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index 0baf3c1f4b0..7a9041ed4df 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel os.getcwd()!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel os.getcwd()!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil slice2cpp = '"%s"' % os.path.join(TestUtil.getCppBinDir(), "slice2cpp") @@ -32,7 +32,8 @@ files.sort() for file in files: - print file + "...", + sys.stdout.write(file + "... ") + sys.stdout.flush() if file.find("Underscore") != -1: command = slice2cpp + ' --underscore -I. "%s"' % os.path.join(os.getcwd(), file) @@ -45,19 +46,23 @@ for file in files: lines1 = stderr.readlines() lines2 = open(os.path.join(os.getcwd(), regex1.sub(".err", file)), "r").readlines() if len(lines1) != len(lines2): - print "failed! " + print("failed!") sys.exit(1) regex2 = re.compile("^.*(?=" + file + ")") i = 0 while i < len(lines1): - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() + if sys.version_info[0] == 2: + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + else: + line1 = regex2.sub("", lines1[i].decode("utf-8")).strip() + line2 = regex2.sub("", lines2[i]).strip() if line1 != line2: - print "failed! " + print("failed!") sys.exit(1) i = i + 1 else: - print "ok" + print("ok") sys.exit(0) |