summaryrefslogtreecommitdiff
path: root/scripts/TestController.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2015-04-07 19:24:08 +0200
committerBenoit Foucher <benoit@zeroc.com>2015-04-07 19:24:08 +0200
commit92b20f89662b327edf8f732d082d9fd07da9c665 (patch)
tree1224af8f2d610322a2ab6520471c503af0e20fe0 /scripts/TestController.py
parentFixed IceSSL OpenSSL bug which could cause a crash when loading a certificate... (diff)
downloadice-92b20f89662b327edf8f732d082d9fd07da9c665.tar.bz2
ice-92b20f89662b327edf8f732d082d9fd07da9c665.tar.xz
ice-92b20f89662b327edf8f732d082d9fd07da9c665.zip
ICE-6382: removed iceca and fixed makecerts.py to depend on IceCertUtils PyPI package
Diffstat (limited to 'scripts/TestController.py')
-rw-r--r--scripts/TestController.py56
1 files changed, 32 insertions, 24 deletions
diff --git a/scripts/TestController.py b/scripts/TestController.py
index e9e58ed7cf1..cb6597b4948 100644
--- a/scripts/TestController.py
+++ b/scripts/TestController.py
@@ -21,6 +21,18 @@ if len(path) == 0:
sys.path.append(os.path.join(path[0], "scripts"))
import TestUtil
+def removeTrustSettings():
+ serverCert = os.path.join(path[0], "certs", "server.pem")
+ if os.system("security verify-cert -c " + serverCert + " >& /dev/null") == 0:
+ sys.stdout.write("removing trust settings for the HTTP server certificate... ")
+ sys.stdout.flush()
+ if os.system("security remove-trusted-cert " + serverCert) != 0:
+ print("\nerror: couldn't remove trust settings for the HTTP server certificate")
+ else:
+ print("ok")
+ else:
+ print("trust settings already removed")
+
#
# On OS X, provide an option to allow removing the trust settings
#
@@ -28,15 +40,7 @@ if TestUtil.isDarwin():
try:
opts, args = getopt.getopt(sys.argv[1:], "", ["clean"])
if ("--clean", "") in opts:
- serverCert = os.path.join(path[0], "certs", "s_rsa1024_pub.pem")
- if os.system("security verify-cert -c " + serverCert + " >& /dev/null") == 0:
- sys.stdout.write("removing trust settings for the HTTP server certificate... ")
- sys.stdout.flush()
- if os.system("security remove-trusted-cert " + serverCert) != 0:
- print("error: couldn't remove trust settings for the HTTP server certificate")
- print("ok")
- else:
- print("trust settings already removed")
+ removeTrustSettings()
sys.exit(0)
except getopt.GetoptError:
pass
@@ -44,7 +48,10 @@ if TestUtil.isDarwin():
version = "3.6.0"
jar = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
"java/test/controller/build/libs/testController-%(version)s.jar" % {"version": version})
-command = ["%s/bin/java" % os.environ.get("JAVA_HOME"), "-jar", jar]
+
+javaHome = os.environ.get("JAVA_HOME", "")
+javaCmd = '"%s"' % os.path.join(javaHome, "bin", "java") if javaHome else "java"
+command = [javaCmd, "-jar", jar]
p = subprocess.Popen(command, shell = False, stdin = subprocess.PIPE, stdout = subprocess.PIPE,
stderr = subprocess.STDOUT, bufsize = 0)
@@ -55,19 +62,6 @@ def signal_handler(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
-while(True):
-
- c = p.stdout.read(1)
- if not c: break
- if c == '\r': continue
-
- # Depending on Python version and platform, the value c could be a
- # string or a bytes object.
- if type(c) != str:
- c = c.decode()
- sys.stdout.write(c)
- sys.stdout.flush()
-
if TestUtil.isDarwin():
#
# On OS X, we set the trust settings on the certificate to prevent
@@ -75,10 +69,24 @@ if TestUtil.isDarwin():
# certificate. Some browsers such as Chrome don't provide the
# option to set this trust settings.
#
- serverCert = os.path.join(TestUtil.toplevel, "certs", "s_rsa1024_pub.pem")
+ serverCert = os.path.join(TestUtil.toplevel, "certs", "server.pem")
if os.system("security verify-cert -c " + serverCert + " >& /dev/null") != 0:
sys.stdout.write("adding trust settings for the HTTP server certificate... ")
sys.stdout.flush()
if os.system("security add-trusted-cert -r trustAsRoot " + serverCert) != 0:
print("error: couldn't add trust settings for the HTTP server certificate")
print("ok")
+ print("run " + sys.argv[0] + " --clean to remove the trust setting")
+
+while(True):
+
+ c = p.stdout.read(1)
+ if not c: break
+ if c == '\r': continue
+
+ # Depending on Python version and platform, the value c could be a
+ # string or a bytes object.
+ if type(c) != str:
+ c = c.decode()
+ sys.stdout.write(c)
+ sys.stdout.flush()