summaryrefslogtreecommitdiff
path: root/ruby/test
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-09-17 00:28:00 +0200
committerJose <jose@zeroc.com>2016-09-17 00:28:00 +0200
commit47c3b5d2b03d3286cba2a3b4890e57fdd6135132 (patch)
tree40e05ffec6df92a5b88fdb675d775580f41547c1 /ruby/test
parent3.6.3 version fixes (diff)
downloadice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.bz2
ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.xz
ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.zip
Fix ICE-4787 - slice compilers and unicode paths
Diffstat (limited to 'ruby/test')
-rwxr-xr-xruby/test/Ice/properties/run.py14
-rw-r--r--ruby/test/Slice/unicodePaths/run.py83
2 files changed, 90 insertions, 7 deletions
diff --git a/ruby/test/Ice/properties/run.py b/ruby/test/Ice/properties/run.py
index ad42dbd1565..70e96e63e13 100755
--- a/ruby/test/Ice/properties/run.py
+++ b/ruby/test/Ice/properties/run.py
@@ -31,13 +31,13 @@ else:
configPath = "./config/\u4e2d\u56fd_client.config"
decodedPath = configPath # No need to decode with Python3, strings are already Unicode
-TestUtil.createConfig(decodedPath,
- ["# Automatically generated by Ice test driver.",
- "Ice.Trace.Protocol=1",
- "Ice.Trace.Network=1",
- "Ice.ProgramName=PropertiesClient",
- "Config.Path=" + configPath],
- "utf-8")
+TestUtil.createFile(decodedPath,
+ ["# Automatically generated by Ice test driver.",
+ "Ice.Trace.Protocol=1",
+ "Ice.Trace.Network=1",
+ "Ice.ProgramName=PropertiesClient",
+ "Config.Path=" + configPath],
+ "utf-8")
TestUtil.simpleTest()
diff --git a/ruby/test/Slice/unicodePaths/run.py b/ruby/test/Slice/unicodePaths/run.py
new file mode 100644
index 00000000000..3cd71a25397
--- /dev/null
+++ b/ruby/test/Slice/unicodePaths/run.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys, locale, shutil
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+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 RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+def test(b):
+ if not b:
+ print("failed!")
+ sys.exit(1)
+
+if TestUtil.isAIX():
+ encoding = locale.getdefaultlocale()[1]
+ if encoding != "UTF-8":
+ print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8")
+ print("Skipping test")
+ sys.exit(0)
+
+if sys.version_info[0] == 2 and TestUtil.isWin32():
+ print("To run this test on Windows you need to be using Python 3.x")
+ print("Python 2.x subprocess module doesn't support unicode on Windows")
+ print("Skipping tes")
+ sys.exit(0)
+
+if os.environ.get("USE_BIN_DIST", "no") == "yes":
+ if TestUtil.isDarwin():
+ slice2rb = sys.executable + " /usr/local/bin/slice2rb"
+ elif TestUtil.isWin32():
+ pythonHome = os.path.dirname(sys.executable)
+ slice2rb = sys.executable + " " + os.path.join(pythonHome, "Scripts", "slice2rb.exe")
+ elif TestUtil.isYocto():
+ slice2rb = os.path.join(TestUtil.getCppBinDir(), "slice2rb")
+ else:
+ import slice2rb
+ slice2rb = sys.executable + " " + os.path.normpath(os.path.join(slice2rb.__file__, "..", "..", "..", "..", "bin", "slice2rb"))
+else:
+ if TestUtil.isYocto():
+ slice2rb = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "..", "cpp", "bin", "slice2rb")
+ else:
+ slice2rb = "ruby " + os.path.join(path[0], "ruby", "config", "s2rb.rb")
+
+sys.stdout.write("testing Slice compiler and unicode file paths... ")
+sys.stdout.flush()
+
+#
+# Write Slice file
+#
+if sys.version_info[0] == 2:
+ srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd".decode("utf-8")
+else:
+ srcPath = "./\u4e2d\u56fd"
+if os.path.exists(srcPath):
+ shutil.rmtree(srcPath)
+os.mkdir(srcPath)
+
+TestUtil.createFile("%s/Test.ice" % srcPath, ["module Test { ",
+ "class Point{int x; int y; };",
+ "interface Canvas{ void draw(Point p); };",
+ "};"], "utf-8")
+p = TestUtil.runCommand('%s %s/Test.ice --output-dir %s' % (slice2rb, srcPath, srcPath))
+test(p.wait() == 0)
+test(os.path.isfile("%s/Test.rb" % srcPath))
+
+if os.path.exists(srcPath):
+ shutil.rmtree(srcPath)
+print("ok")