summaryrefslogtreecommitdiff
path: root/scripts/TestUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/TestUtil.py')
-rwxr-xr-xscripts/TestUtil.py106
1 files changed, 57 insertions, 49 deletions
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 27af43dca48..bd8e4bb41e1 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -512,8 +512,9 @@ def run(tests, root = False):
filters.append((testFilter, False))
elif o == "--cross":
global cross
- if a not in ["cpp", "csharp", "java", "js", "python", "ruby", "objective-c" ]:
- print("cross must be one of cpp, csharp, java, js, python, ruby or objective-c")
+ crossLang = ["cpp", "csharp", "java", "js", "php", "python", "ruby", "objective-c"]
+ if a not in crossLang:
+ print("cross must be one of %s" % ', '.join(crossLang))
sys.exit(1)
cross.append(a)
elif o == "--all" :
@@ -591,13 +592,15 @@ def run(tests, root = False):
if allCross:
if len(cross) == 0:
- cross = ["cpp", "java", "js"]
+ cross = ["cpp", "java", "js", "php", "python", "ruby"]
if isWin32():
cross.append("csharp")
+ # TODO/XXX: we're currently not building Ruby on Windows
+ cross.remove('ruby')
if isDarwin():
cross.append("objective-c")
if root:
- allLang = ["cpp", "java", "js"]
+ allLang = ["cpp", "java", "js", "python"]
if isWin32():
allLang.append("csharp")
if isDarwin():
@@ -697,25 +700,36 @@ def getSliceDir():
return os.path.join(toplevel, "slice")
def phpCleanup():
- if os.path.exists("tmp.ini"):
- os.remove("tmp.ini")
if os.path.exists("ice.profiles"):
os.remove("ice.profiles")
-def phpSetup(clientConfig = False, iceOptions = None, iceProfile = None):
+def phpProfileSetup(clientConfig = False, iceOptions = None, iceProfile = None):
+ interpreterOptions = []
+
+ if iceProfile != None:
+ atexit.register(phpCleanup)
+ interpreterOptions.append("-d ice.profiles='ice.profiles'")
+ tmpProfiles = open("ice.profiles", "w")
+ tmpProfiles.write("[%s]\n" % iceProfile)
+ if clientConfig:
+ tmpProfiles.write("ice.config=\"config.client\"\n")
+ if iceOptions != None:
+ tmpProfiles.write("ice.options=\"%s\"\n" % iceOptions)
+ tmpProfiles.close()
+ else:
+ if clientConfig:
+ interpreterOptions.append("-d ice.config='config.client'")
+ if iceOptions != None:
+ interpreterOptions.append("-d ice.options='%s'" % iceOptions)
+
+ return ' '.join(interpreterOptions)
+
+def phpFlags():
+ flags = []
extDir = None
ext = None
incDir = None
- #
- # TODO
- #
- # When we no longer support PHP 5.1.x, we can use the following PHP
- # command-line options:
- #
- # -d extension_dir=...
- # -d extension=[php_ice.dll|IcePHP.so]
- #
if isWin32():
ext = "php_ice.dll"
if not iceHome:
@@ -768,29 +782,13 @@ def phpSetup(clientConfig = False, iceOptions = None, iceProfile = None):
print("unable to find IcePHP extension!")
sys.exit(1)
- atexit.register(phpCleanup)
- tmpini = open("tmp.ini", "w")
- tmpini.write("; Automatically generated by Ice test driver.\n")
if extDir:
- tmpini.write("extension_dir=\"%s\"\n" % extDir)
- tmpini.write("extension=%s\n" % ext)
+ flags.append("-d extension_dir='%s'" % extDir)
+ flags.append("-d extension='%s'" % ext)
if incDir:
- tmpini.write("include_path=\"%s\"\n" % incDir)
- if iceProfile != None:
- tmpini.write("ice.profiles=\"ice.profiles\"\n")
- tmpProfiles = open("ice.profiles", "w")
- tmpProfiles.write("[%s]\n" % iceProfile)
- if clientConfig:
- tmpProfiles.write("ice.config=\"config.client\"\n")
- if iceOptions != None:
- tmpProfiles.write("ice.options=\"%s\"\n" % iceOptions)
- tmpProfiles.close()
- else:
- if clientConfig:
- tmpini.write("ice.config=\"config.client\"\n")
- if iceOptions != None:
- tmpini.write("ice.options=\"%s\"\n" % iceOptions)
- tmpini.close()
+ flags.append("-d include_path='%s'" % incDir)
+
+ return ' '.join(flags)
def getIceBox():
global cpp11
@@ -1164,7 +1162,7 @@ def getCommandLine(exe, config, options = "", interpreterOptions = ""):
output.write(" " + interpreterOptions)
output.write(' "%s" ' % exe)
elif config.lang == "php" and config.type == "client":
- output.write(phpCmd + " -n -c tmp.ini")
+ output.write(phpCmd + " -n %s" % phpFlags())
if interpreterOptions:
output.write(" " + interpreterOptions)
output.write(" -f \""+ exe +"\" -- ")
@@ -1498,6 +1496,11 @@ def clientServerTest(additionalServerOptions = "", additionalClientOptions = "",
clientdir = getMirrorDir(getClientCrossTestDir(testdir), clientLang)
else:
clientdir = getMirrorDir(testdir, clientLang)
+
+ client = getDefaultClientFile(clientLang)
+ clientDesc = os.path.basename(client)
+ clientCfg.lang = clientLang
+
if not os.path.exists(clientdir):
print("** no matching test for %s" % clientLang)
return
@@ -1516,9 +1519,6 @@ def clientServerTest(additionalServerOptions = "", additionalClientOptions = "",
if clientenv is None:
clientenv = getTestEnv(clientLang, clientdir)
- if lang == "php":
- phpSetup()
-
clientExe = client
serverExe = server
@@ -1648,9 +1648,6 @@ def clientEchoTest(additionalServerOptions = "", additionalClientOptions = "",
if clientenv is None:
clientenv = getTestEnv(clientLang, clientdir)
- if lang == "php":
- phpSetup()
-
clientExe = client
serverExe = server
@@ -1701,9 +1698,13 @@ def startClient(exe, args = "", config=None, env=None, echo = True, startReader
config = DriverConfig("client")
if env is None:
env = getTestEnv(getDefaultMapping(), os.getcwd())
- cmd = getCommandLine(exe, config, args)
+
+ interpreterOptions = ""
if config.lang == "php":
- phpSetup(clientConfig, iceOptions, iceProfile)
+ interpreterOptions = phpProfileSetup(clientConfig, iceOptions, iceProfile)
+
+ cmd = getCommandLine(exe, config, args, interpreterOptions)
+
return spawnClient(cmd, env = env, echo = echo, startReader = startReader, lang=config.lang)
def startServer(exe, args = "", config = None, env = None, adapter = None, count = 1, echo = True, timeout = 60,
@@ -1713,7 +1714,8 @@ def startServer(exe, args = "", config = None, env = None, adapter = None, count
if env is None:
env = getTestEnv(getDefaultMapping(), os.getcwd())
cmd = getCommandLine(exe, config, args, interpreterOptions)
- return spawnServer(cmd, env = env, adapter = adapter, count = count, echo = echo, lang = config.lang, mx = config.mx, timeout = timeout)
+ return spawnServer(cmd, env = env, adapter = adapter, count = count, echo = echo, lang = config.lang,
+ mx = config.mx, timeout = timeout)
def startColloc(exe, args, config=None, env=None, interpreterOptions = ""):
exe = quoteArgument(exe)
@@ -2138,8 +2140,9 @@ def processCmdLine():
elif o == "--cross":
global cross
cross.append(a)
- if not a in ["cpp", "csharp", "java", "js", "python", "ruby", "objective-c" ]:
- print("cross must be one of cpp, csharp, java, js, python, ruby or objective-c")
+ crossLang = ["cpp", "csharp", "java", "js", "php", "python", "ruby", "objective-c"]
+ if not a in crossLang:
+ print("cross must be one of %s" % ', '.join(crossLang))
sys.exit(1)
if getTestName() not in crossTests:
print("*** This test does not support cross language testing")
@@ -2397,6 +2400,11 @@ def runTests(start, expanded, num = 0, script = False):
print("%s*** test not supported with appverifier%s" % (prefix, suffix))
continue
+ # Skip tests that no not exist for this language mapping
+ if not os.path.exists(dir):
+ print("%s*** test does not exist for this language mapping%s" % (prefix, suffix))
+ continue
+
if script:
print("echo \"*** test started: `date`\"")
print("cd %s" % dir)