diff options
author | Mark Spruiell <mes@zeroc.com> | 2007-02-09 17:05:00 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2007-02-09 17:05:00 +0000 |
commit | c3f0daced1a0290d264c2e5d5ff9126ea95ad3b9 (patch) | |
tree | d405acda69b789945b3b1db25cb264e8e345b4f7 /java/config/TestUtil.py | |
parent | Fixed bug #1796 (diff) | |
download | ice-c3f0daced1a0290d264c2e5d5ff9126ea95ad3b9.tar.bz2 ice-c3f0daced1a0290d264c2e5d5ff9126ea95ad3b9.tar.xz ice-c3f0daced1a0290d264c2e5d5ff9126ea95ad3b9.zip |
bug 1777: test/Ice/threads vs. JDK 1.4
Diffstat (limited to 'java/config/TestUtil.py')
-rw-r--r-- | java/config/TestUtil.py | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/java/config/TestUtil.py b/java/config/TestUtil.py index 83ca94bff02..fa1ce1954fa 100644 --- a/java/config/TestUtil.py +++ b/java/config/TestUtil.py @@ -79,36 +79,6 @@ for o, a in opts: if o == "--host": host = a -# -# If we are using SSL as the default protocol, we need to examine -# the Java version to determine whether thread-per-connection is -# required. -# -javaCmd = "java" -jdk14 = False -if protocol == "ssl": - javaPipeIn, javaPipeOut = os.popen4("java -version") - if not javaPipeIn or not javaPipeOut: - print "unable to get Java version!" - sys.exit(1) - version = javaPipeOut.readline() - if not version: - print "unable to get Java version!" - sys.exit(1) - if version.startswith("java version \"1.4"): - # - # IceSSL requires JDK thread-per-connection when used with JDK 1.4. - # - threadPerConnection = 1 - # - # To avoid the potential for long delays at startup under JDK 1.4, - # we direct the JVM to use /dev/urandom instead of its default. - # - javaCmd = "java -Djava.security.egd=file:/dev/urandom" - jdk14 = True - javaPipeIn.close() - javaPipeOut.close() - def isCygwin(): # The substring on sys.platform is required because some cygwin @@ -296,6 +266,32 @@ def printOutputFromPipe(pipe): break os.write(1, c) +def getIceSslVersion(): + javaPipeIn, javaPipeOut = os.popen4("java IceSSL.Util") + if not javaPipeIn or not javaPipeOut: + print "unable to get IceSSL version!" + sys.exit(1) + version = javaPipeOut.readline() + if not version: + print "unable to get IceSSL version!" + sys.exit(1) + javaPipeIn.close() + javaPipeOut.close() + return version.strip() + +def getJdkVersion(): + javaPipeIn, javaPipeOut = os.popen4("java -version") + if not javaPipeIn or not javaPipeOut: + print "unable to get Java version!" + sys.exit(1) + version = javaPipeOut.readline() + if not version: + print "unable to get Java version!" + sys.exit(1) + javaPipeIn.close() + javaPipeOut.close() + return version + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): @@ -312,6 +308,29 @@ else: os.environ["CLASSPATH"] = os.path.join(toplevel, "lib", "Ice.jar") + sep + os.getenv("CLASSPATH", "") os.environ["CLASSPATH"] = os.path.join(toplevel, "lib") + sep + os.getenv("CLASSPATH", "") +# +# If we are using SSL as the default protocol, we need to take extra +# precautions when using JDK 1.4. +# +javaCmd = "java" +jdkVersion = None +iceSslVersion = None +if protocol == "ssl": + jdkVersion = getJdkVersion() + if jdkVersion.startswith("java version \"1.4"): + # + # To avoid the potential for long delays at startup under JDK 1.4, + # we direct the JVM to use /dev/urandom instead of its default. + # + javaCmd = "java -Djava.security.egd=file:/dev/urandom" + + iceSslVersion = getIceSslVersion() + if iceSslVersion == "1.4": + # + # IceSSL for JDK 1.4 requires thread-per-connection. + # + threadPerConnection = 1 + if protocol == "ssl": plugin = " --Ice.Plugin.IceSSL=IceSSL.PluginFactory" clientProtocol = plugin + " --Ice.Default.Protocol=ssl" + \ |