summaryrefslogtreecommitdiff
path: root/java/test/Slice/generation/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'java/test/Slice/generation/run.py')
-rwxr-xr-xjava/test/Slice/generation/run.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/java/test/Slice/generation/run.py b/java/test/Slice/generation/run.py
index d7cf9c52d2d..4d77c036b02 100755
--- a/java/test/Slice/generation/run.py
+++ b/java/test/Slice/generation/run.py
@@ -16,11 +16,12 @@ 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
-print "testing list-generated...",
+sys.stdout.write("testing list-generated... ")
+sys.stdout.flush()
slice2java = os.path.join(TestUtil.getCppBinDir(), "slice2java")
if not os.path.exists("classes"):
@@ -28,23 +29,27 @@ if not os.path.exists("classes"):
command = '"' + slice2java + '" --list-generated --output-dir classes File1.ice File2.ice'
if TestUtil.debug:
- print "(%s)" % command,
+ sys.stdout.write("(%s) " % command)
p = TestUtil.runCommand(command)
lines1 = p.stdout.readlines()
lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines()
if len(lines1) != len(lines2):
- print "failed!"
+ print("failed!")
sys.exit(1)
i = 0
while i < len(lines1):
- line1 = lines1[i].strip()
- line2 = lines2[i].strip()
+ if sys.version_info[0] == 2:
+ line1 = lines1[i].strip()
+ line2 = lines2[i].strip()
+ else:
+ line1 = lines1[i].decode("utf-8").strip()
+ line2 = lines2[i].strip()
if line1 != line2:
- print "failed!"
+ print("failed!")
sys.exit(1)
i = i + 1
else:
- print "ok"
+ print("ok")
sys.exit(0)