diff options
-rw-r--r-- | cpp/test/Slice/headers/test.py | 2 | ||||
-rw-r--r-- | scripts/Component.py | 268 | ||||
-rw-r--r-- | scripts/Glacier2Util.py | 2 | ||||
-rw-r--r-- | scripts/IceBoxUtil.py | 74 | ||||
-rw-r--r-- | scripts/IceBridgeUtil.py | 2 | ||||
-rw-r--r-- | scripts/IceGridUtil.py | 9 | ||||
-rw-r--r-- | scripts/IcePatch2Util.py | 6 | ||||
-rw-r--r-- | scripts/IceStormUtil.py | 6 | ||||
-rw-r--r-- | scripts/LocalDriver.py | 16 | ||||
-rw-r--r-- | scripts/Util.py | 968 | ||||
-rw-r--r-- | scripts/tests/IceBox/admin.py | 4 | ||||
-rw-r--r-- | scripts/tests/IceBox/configuration.py | 4 |
12 files changed, 699 insertions, 662 deletions
diff --git a/cpp/test/Slice/headers/test.py b/cpp/test/Slice/headers/test.py index 54afc982e57..ab2931eff7d 100644 --- a/cpp/test/Slice/headers/test.py +++ b/cpp/test/Slice/headers/test.py @@ -23,7 +23,7 @@ class SliceHeadersTestCase(ClientTestCase): os.symlink("dir2", os.path.join("slices", "linktodir2")) basedir = self.testsuite.getPath() - slicedir = current.driver.getSliceDir(self.mapping, current) + slicedir = component.getSliceDir(self.mapping, current) os.symlink(slicedir, "iceslices") def runTest(args): diff --git a/scripts/Component.py b/scripts/Component.py new file mode 100644 index 00000000000..92fe6b81805 --- /dev/null +++ b/scripts/Component.py @@ -0,0 +1,268 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2018 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 + +from Util import * + +class Ice(Component): + + # All option values for Ice/IceBox tests. + coreOptions = { + "protocol" : ["tcp", "ssl", "wss", "ws"], + "compress" : [False, True], + "ipv6" : [False, True], + "serialize" : [False, True], + "mx" : [False, True], + } + + # All option values for IceGrid/IceStorm/Glacier2/IceDiscovery tests. + serviceOptions = { + "protocol" : ["tcp", "wss"], + "compress" : [False, True], + "ipv6" : [False, True], + "serialize" : [False, True], + "mx" : [False, True], + } + + def __init__(self): + self.nugetVersion = None + + def useBinDist(self, mapping, current): + return Component._useBinDist(self, mapping, current, "ICE_BIN_DIST") + + def getInstallDir(self, mapping, current): + return Component._getInstallDir(self, mapping, current, "ICE_HOME") + + def getPhpExtension(self, mapping, current): + if isinstance(platform, Windows): + return "php_ice.dll" if current.driver.configs[mapping].buildConfig in ["Debug", "Release"] else "php_ice_nts.dll" + else: + return "ice.so" + + def getNugetPackage(self, mapping, compiler=None): + if isinstance(mapping, CSharpMapping): + return "zeroc.ice.net" + else: + return "zeroc.ice.{0}".format(compiler) + + def getNugetPackageVersion(self, mapping): + if not self.nugetVersion: + if isinstance(mapping, CSharpMapping): + with open(os.path.join(toplevel, "csharp", "msbuild", "zeroc.ice.net.nuspec"), "r") as configFile: + self.nugetVersion = re.search("<version>(.*)</version>", configFile.read()).group(1) + else: + with open(os.path.join(toplevel, "config", "icebuilder.props"), "r") as configFile: + self.nugetVersion = re.search("<IceJSONVersion>(.*)</IceJSONVersion>", configFile.read()).group(1) + return self.nugetVersion + + def getFilters(self, mapping, config): + if "xcodesdk" in config.buildConfig: + return (["Ice/.*", "IceSSL/configuration"], + ["Ice/background", + "Ice/echo", + "Ice/faultTolerance", + "Ice/gc", + "Ice/library", + "Ice/logger", + "Ice/properties", + "Ice/plugin", + "Ice/stringConverter", + "Ice/threadPoolPriority", + "Ice/udp"]) + elif "static" in config.buildConfig: + return (["Ice/.*", "IceSSL/configuration", "IceDiscovery/simple", "IceGrid/simple", "Glacier2/application"], + ["Ice/library", "Ice/plugin"]) + elif config.uwp: + return (["Ice/.*", "IceSSL/configuration"], + ["Ice/background", + "Ice/echo", + "Ice/faultTolerance", + "Ice/gc", + "Ice/library", + "Ice/logger", + "Ice/networkProxy", # SOCKS proxy not supported with UWP + "Ice/properties", # Property files are not supported with UWP + "Ice/plugin", + "Ice/threadPoolPriority"]) + elif isinstance(platform, Windows) and platform.getCompiler() in ["VC100"]: + return (["Ice/.*", "IceSSL/.*", "IceBox/.*", "IceDiscovery/.*", "IceUtil/.*", "Slice/.*"], []) + elif isinstance(mapping, AndroidMappingMixin): + return (["Ice/.*"], + ["Ice/hash", + "Ice/faultTolerance", + "Ice/metrics", + "Ice/networkProxy", + "Ice/throughput", + "Ice/plugin", + "Ice/logger", + "Ice/properties"]) + return ([], []) + + def canRun(self, testId, mapping, current): + parent = re.match(r'^([\w]*).*', testId).group(1) + if isinstance(platform, Linux): + if self.linuxId in ["centos", "rhel", "fedora"] and current.config.buildPlatform == "x86": + # + # Don't test Glacier2/IceStorm/IceGrid services with multilib platforms. We only + # build services for the native platform. + # + if parent in ["Glacier2", "IceStorm", "IceGrid"]: + return False + elif isinstance(platform, Linux): + # + # On Windows, if testing with a binary distribution, don't test Glacier2/IceBridge services + # with the Debug configurations since we don't provide binaries for them. + # + if self.useBinDist(mapping, current): + if parent in ["Glacier2", "IceBridge"] and current.config.buildConfig.find("Debug") >= 0: + return False + + # No C++11 tests for IceStorm, IceGrid, etc + if isinstance(mapping, CppMapping) and current.config.cpp11: + if parent in ["IceStorm", "IceBridge"]: + return False + elif parent in ["IceGrid"] and testId not in ["IceGrid/simple"]: + return False + elif parent in ["Glacier2"] and testId not in ["Glacier2/application", "Glacier2/sessionHelper"]: + return False + + if isinstance(mapping, CSharpMapping) and current.config.netframework: + # + # The following tests require multicast, on Unix platforms it's currently only supported + # with IPv4 due to .NET Core bug https://github.com/dotnet/corefx/issues/25525 + # + if not isinstance(platform, Windows) and current.config.ipv6 and testId in ["Ice/udp", + "IceDiscovery/simple", + "IceGrid/simple"]: + return False + + if isinstance(platform, Darwin): + if parent in ["IceSSL", "IceDiscovery"]: + return False + + # TODO: Remove once https://github.com/dotnet/corefx/issues/28759 is fixed + if testId == "Ice/adapterDeactivation" and current.config.protocol in ["ssl", "wss"]: + return False + + return True + + def isMainThreadOnly(self, testId): + return testId.startswith("IceStorm") # TODO: WORKAROUND for ICE-8175 + + def getDefaultProcesses(self, mapping, processType, testId): + if testId.startswith("IceUtil") or testId.startswith("Slice"): + return [SimpleClient()] + elif testId.startswith("IceGrid"): + if processType in ["client", "collocated"]: + return [IceGridClient()] + if processType in ["server", "serveramd"]: + return [IceGridServer()] + + def getOptions(self, testcase, current): + parent = re.match(r'^([\w]*).*', testcase.getTestSuite().getId()).group(1) + if isinstance(testcase, ClientServerTestCase) and parent in ["Ice", "IceBox"]: + return self.coreOptions + elif parent in ["IceGrid", "Glacier2", "IceStorm", "IceDiscovery", "IceBridge"]: + return self.serviceOptions + + def getRunOrder(self): + return ["Slice", "IceUtil", "Ice", "IceSSL", "IceBox", "Glacier2", "IceGrid", "IceStorm"] + + def isCross(self, testId): + return testId in [ + "Ice/ami", + "Ice/info", + "Ice/exceptions", + "Ice/enums", + "Ice/facets", + "Ice/inheritance", + "Ice/invoke", + "Ice/objects", + "Ice/operations", + "Ice/proxy", + "Ice/servantLocator", + "Ice/slicing/exceptions", + "Ice/slicing/objects", + "Ice/optional" + ] + + def getSoVersion(self): + config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r") + intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) + majorVersion = int(intVersion / 10000) + minorVersion = int(intVersion / 100) - 100 * majorVersion + patchVersion = intVersion % 100 + if patchVersion < 50: + return '%d' % (majorVersion * 10 + minorVersion) + elif patchVersion < 60: + return '%da%d' % (majorVersion * 10 + minorVersion, patchVersion - 50) + else: + return '%db%d' % (majorVersion * 10 + minorVersion, patchVersion - 60) + +component = Ice() + +from Glacier2Util import * +from IceBoxUtil import * +from IceBridgeUtil import * +from IcePatch2Util import * +from IceGridUtil import * +from IceStormUtil import * + +# +# Supported mappings +# +for m in filter(lambda x: os.path.isdir(os.path.join(toplevel, x)), os.listdir(toplevel)): + if m == "cpp" or re.match("cpp-.*", m): + Mapping.add(m, CppMapping()) + elif m == "java-compat" or re.match("java-compat-.*", m): + Mapping.add(m, JavaCompatMapping()) + elif m == "java" or re.match("java-.*", m): + Mapping.add(m, JavaMapping()) + elif m == "python" or re.match("python-.*", m): + Mapping.add(m, PythonMapping()) + elif m == "ruby" or re.match("ruby-.*", m): + Mapping.add(m, RubyMapping()) + elif m == "php" or re.match("php-.*", m): + Mapping.add(m, PhpMapping()) + elif m == "js" or re.match("js-.*", m): + Mapping.add(m, JavaScriptMapping()) + elif m == "objective-c" or re.match("objective-c-*", m): + Mapping.add(m, ObjCMapping()) + elif m == "csharp" or re.match("charp-.*", m): + Mapping.add("csharp", CSharpMapping()) + +if isinstance(platform, Windows): + # Windows doesn't support all the mappings, we take them out here. + Mapping.remove("ruby") + if platform.getCompiler() != "VC140": + Mapping.remove("python") + Mapping.remove("php") +elif not platform.hasDotNet(): + # Remove C# if Dot Net Core isn't supported + Mapping.remove("csharp", CSharpMapping()) + +# +# Check if the Android SDK is installed and eventually add the Android mappings +# +try: + run("adb version") + Mapping.add(os.path.join("java-compat", "android"), AndroidCompatMapping()) + Mapping.add(os.path.join("java", "android"), AndroidMapping()) +except: + pass + +# +# Check if Matlab is installed and eventually add the Matlab mapping +# +try: + run("where matlab" if isinstance(platform, Windows) else "which matlab") + Mapping.add("matlab", MatlabMapping()) +except: + pass diff --git a/scripts/Glacier2Util.py b/scripts/Glacier2Util.py index 2004a817a79..90fb02fefd1 100644 --- a/scripts/Glacier2Util.py +++ b/scripts/Glacier2Util.py @@ -10,7 +10,7 @@ import sys, os from Util import * -class Glacier2Router(ProcessFromBinDir, Server): +class Glacier2Router(ProcessFromBinDir, ProcessIsReleaseOnly, Server): def __init__(self, portnum=50, passwords={"userid": "abc123"}, *args, **kargs): Server.__init__(self, "glacier2router", mapping=Mapping.getByName("cpp"), desc="Glacier2 router", diff --git a/scripts/IceBoxUtil.py b/scripts/IceBoxUtil.py index 5b0ce467bd5..273d48e9128 100644 --- a/scripts/IceBoxUtil.py +++ b/scripts/IceBoxUtil.py @@ -12,45 +12,71 @@ from Util import * class IceBox(ProcessFromBinDir, Server): - processType = "icebox" - - def __init__(self, *args, **kargs): + def __init__(self, configFile=None, *args, **kargs): Server.__init__(self, *args, **kargs) - - # Find config file - if 'args' in kargs: - for v in kargs['args']: - if "--Ice.Config=" in v: - self.config = v.replace("--Ice.Config=", "") - break + self.configFile = configFile def setup(self, current): - mapping = self.mapping or current.testcase.getMapping() + mapping = self.getMapping(current) + # # If running IceBox tests with .NET Core we need to generate a config # file that use the service for the .NET Framework used to build the # tests # - if isinstance(mapping, CSharpMapping) and current.config.netframework: + if self.configFile: + if isinstance(mapping, CSharpMapping) and current.config.netframework: + configFile = self.configFile.format(testdir=current.testsuite.getPath()) + netframework ="\\netstandard2.0\\{0}\\".format(current.config.netframework) + with open(configFile, 'r') as source: + with open(configFile + ".{0}".format(current.config.netframework), 'w') as target: + for line in source.readlines(): + target.write(line.replace("\\net45\\", netframework)) + current.files.append(configFile + ".{0}".format(current.config.netframework)) - targetConfig = os.path.abspath( - self.config.strip('"').format(testdir=current.testsuite.getPath(), - iceboxconfigext=".{0}".format(current.config.netframework))) - baseConfig = targetConfig.rstrip(".{0}".format(current.config.netframework)) - with open(baseConfig, 'r') as config: - with open(targetConfig, 'w') as target: - for line in config.readlines(): - target.write(line.replace("\\net45\\", "\\netstandard2.0\\{0}\\".format(current.config.netframework))) - current.files.append(targetConfig) + def getExe(self, current): + mapping = self.getMapping(current) + if isinstance(mapping, JavaCompatMapping): + return "IceBox.Server" + elif isinstance(mapping, JavaMapping): + return "com.zeroc.IceBox.Server" + elif isinstance(mapping, CSharpMapping): + return "iceboxnet" + else: + name = "icebox" + if isinstance(platform, Linux) and \ + platform.getLinuxId() in ["centos", "rhel", "fedora"] and \ + current.config.buildPlatform == "x86": + name += "32" # Multilib platform + if current.config.cpp11: + name += "++11" + return name -class IceBoxAdmin(ProcessFromBinDir, Client): + def getEffectiveArgs(self, current, args): + args = Server.getEffectiveArgs(self, current, args) + if self.configFile: + mapping = self.getMapping(current) + if isinstance(mapping, CSharpMapping) and current.config.netframework: + args.append("--Ice.Config={0}".format(self.configFile + ".{0}".format(current.config.netframework))) + else: + args.append("--Ice.Config={0}".format(self.configFile)) + return args - processType = "iceboxadmin" +class IceBoxAdmin(ProcessFromBinDir, ProcessIsReleaseOnly, Client): def getMapping(self, current): # IceBox admin is only provided with the C++/Java, not C# - mapping = self.mapping or current.testcase.getMapping() + mapping = Client.getMapping(self, current) if isinstance(mapping, CppMapping) or isinstance(mapping, JavaMapping): return mapping else: return Mapping.getByName("cpp") + + def getExe(self, current): + mapping = self.getMapping(current) + if isinstance(mapping, JavaCompatMapping): + return "IceBox.Admin" + elif isinstance(mapping, JavaMapping): + return "com.zeroc.IceBox.Admin" + else: + return "iceboxadmin" diff --git a/scripts/IceBridgeUtil.py b/scripts/IceBridgeUtil.py index 0750a5cb1e3..3aa73593c79 100644 --- a/scripts/IceBridgeUtil.py +++ b/scripts/IceBridgeUtil.py @@ -9,7 +9,7 @@ from Util import * -class IceBridge(ProcessFromBinDir, Server): +class IceBridge(ProcessFromBinDir, ProcessIsReleaseOnly, Server): def __init__(self, *args, **kargs): Server.__init__(self, "icebridge", mapping=Mapping.getByName("cpp"), desc="IceBridge", *args, **kargs) diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py index c7cb63e585a..1829fad1c91 100644 --- a/scripts/IceGridUtil.py +++ b/scripts/IceGridUtil.py @@ -9,6 +9,9 @@ import sys, os from Util import * +from IceBoxUtil import * +from Glacier2Util import * +from IcePatch2Util import * class IceGridProcess: @@ -45,7 +48,7 @@ class IceGridClient(IceGridProcess, Client): getParentProps = Client.getProps # Used by IceGridProcess to get the client properties -class IceGridAdmin(ProcessFromBinDir, IceGridClient): +class IceGridAdmin(ProcessFromBinDir, ProcessIsReleaseOnly, IceGridClient): def __init__(self, replica=None, username="admin1", password="test1", *args, **kargs): IceGridClient.__init__(self, replica=replica, exe="icegridadmin", mapping=Mapping.getByName("cpp"), @@ -238,8 +241,8 @@ class IceGridTestCase(TestCase): "properties-override" : self.icegridnode[0].getPropertiesOverride(current), } - if platform.getDotnetExe(): - variables["dotnet.exe"] = platform.getDotnetExe() + if platform.getDotNetExe(): + variables["dotnet.exe"] = platform.getDotNetExe() # Add variables that point to the directories containing the built executables for (k, v) in self.exevars.items(): diff --git a/scripts/IcePatch2Util.py b/scripts/IcePatch2Util.py index 84c842e0eb5..5102793e42f 100644 --- a/scripts/IcePatch2Util.py +++ b/scripts/IcePatch2Util.py @@ -9,17 +9,17 @@ from Util import * -class IcePatch2Calc(ProcessFromBinDir, Process): +class IcePatch2Calc(ProcessFromBinDir, ProcessIsReleaseOnly, Process): def __init__(self, *args, **kargs): Process.__init__(self, exe="icepatch2calc", mapping=Mapping.getByName("cpp"), *args, **kargs) -class IcePatch2Client(ProcessFromBinDir, Process): +class IcePatch2Client(ProcessFromBinDir, ProcessIsReleaseOnly, Process): def __init__(self, *args, **kargs): Process.__init__(self, exe="icepatch2client", mapping=Mapping.getByName("cpp"), *args, **kargs) -class IcePatch2Server(ProcessFromBinDir, Process): +class IcePatch2Server(ProcessFromBinDir, ProcessIsReleaseOnly, Process): def __init__(self, *args, **kargs): Process.__init__(self, exe="icepatch2server", mapping=Mapping.getByName("cpp"), *args, **kargs) diff --git a/scripts/IceStormUtil.py b/scripts/IceStormUtil.py index b2fa3f3c758..42ff472ad24 100644 --- a/scripts/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -9,6 +9,8 @@ import sys, os from Util import * +from Component import component +from IceBoxUtil import * class IceStorm(ProcessFromBinDir, Server): @@ -41,7 +43,7 @@ class IceStorm(ProcessFromBinDir, Server): # Default properties props.update({ - 'IceBox.Service.IceStorm' : 'IceStormService,' + getIceSoVersion() + ':createIceStorm', + 'IceBox.Service.IceStorm' : 'IceStormService,' + component.getSoVersion() + ':createIceStorm', 'IceBox.PrintServicesReady' : 'IceStorm', 'IceBox.InheritProperties' : 1, 'IceStorm.InstanceName' : self.instanceName, @@ -141,7 +143,7 @@ class IceStormProcess: props["IceStormAdmin.TopicManager.{0}".format(name)] = testcase.getTopicManager(current, name) return props -class IceStormAdmin(ProcessFromBinDir, IceStormProcess, Client): +class IceStormAdmin(ProcessFromBinDir, ProcessIsReleaseOnly, IceStormProcess, Client): def __init__(self, instanceName=None, instance=None, *args, **kargs): Client.__init__(self, exe="icestormadmin", mapping=Mapping.getByName("cpp"), *args, **kargs) diff --git a/scripts/LocalDriver.py b/scripts/LocalDriver.py index c7fae23def7..813659be5c0 100644 --- a/scripts/LocalDriver.py +++ b/scripts/LocalDriver.py @@ -9,6 +9,7 @@ import sys, os, time, threading from Util import * +from Component import component isPython2 = sys.version_info[0] == 2 @@ -239,6 +240,8 @@ class RemoteTestCaseRunner(TestCaseRunner): return mapping.getTestSuites(testSuiteIds) def filterOptions(self, options): + if options is None: + return None import Ice options = options.copy() for (key, values) in options.items(): @@ -407,7 +410,7 @@ class LocalDriver(Driver): # # Sort the test suites to run tests in the following order. # - runOrder = mapping.getRunOrder() + runOrder = component.getRunOrder() def testsuiteKey(testsuite): for k in runOrder: if testsuite.getId().startswith(k + '/'): @@ -415,15 +418,12 @@ class LocalDriver(Driver): return testsuite.getId() testsuites = sorted(testsuites, key=testsuiteKey) - # - # Create the executor to run the test suites on multiple workers thread is requested. - # for testsuite in testsuites: if mapping.filterTestSuite(testsuite.getId(), self.configs[mapping], self.filters, self.rfilters): continue if testsuite.getId() == "Ice/echo": continue - elif (self.cross or self.allCross) and not testsuite.isCross(): + elif (self.cross or self.allCross) and not component.isCross(testsuite.getId()): continue elif isinstance(self.runner, RemoteTestCaseRunner) and not testsuite.isMultiHost(): continue @@ -550,7 +550,7 @@ class LocalDriver(Driver): if cross: current.writeln("- Mappings: {0},{1}".format(client.getMapping(), server.getMapping())) current.desc += (" " if current.desc else "") + "cross={0}".format(server.getMapping()) - if not current.config.canRun(current) or not current.testcase.canRun(current): + if not current.config.canRun(current.testsuite.getId(), current) or not current.testcase.canRun(current): current.result.skipped(current, "not supported with this configuration") return @@ -587,7 +587,7 @@ class LocalDriver(Driver): if confStr: current.writeln("- Config: {0}".format(confStr)) current.desc = confStr - if not current.config.canRun(current) or not current.testcase.canRun(current): + if not current.config.canRun(current.testsuite.getId(), current) or not current.testcase.canRun(current): current.result.skipped(current, "not supported with this configuration") return @@ -622,7 +622,7 @@ class LocalDriver(Driver): def getMappings(self): return Mapping.getAll(self) if self.allCross else [self.cross] if self.cross else [] - def filterOptions(self, testcase, options): + def filterOptions(self, options): return self.runner.filterOptions(options) Driver.add("local", LocalDriver) diff --git a/scripts/Util.py b/scripts/Util.py index e8e4caf6744..5f491ad483b 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -7,9 +7,8 @@ # # ********************************************************************** -import os, sys, runpy, getopt, traceback, types, threading, time, datetime, re, itertools, random, subprocess, shutil, copy, inspect - -import xml.sax.saxutils +import os, sys, runpy, getopt, traceback, types, threading, time, datetime, re, itertools, random, subprocess, shutil +import copy, inspect, xml.sax.saxutils isPython2 = sys.version_info[0] == 2 if isPython2: @@ -63,18 +62,103 @@ def escapeXml(s, attribute=False): s = illegalXMLChars.sub("?", s) # Strip invalid XML characters return xml.sax.saxutils.quoteattr(s) if attribute else xml.sax.saxutils.escape(s) -def getIceSoVersion(): - config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r") - intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) - majorVersion = int(intVersion / 10000) - minorVersion = int(intVersion / 100) - 100 * majorVersion - patchVersion = intVersion % 100 - if patchVersion < 50: - return '%d' % (majorVersion * 10 + minorVersion) - elif patchVersion < 60: - return '%da%d' % (majorVersion * 10 + minorVersion, patchVersion - 50) - else: - return '%db%d' % (majorVersion * 10 + minorVersion, patchVersion - 60) +""" +Component abstract class. The driver and mapping classes rely on the component +class to provide component specific information. +""" +class Component: + + def __init__(self): + pass + + """ + Returns whether or not to use the binary distribution. + """ + def useBinDist(self, mapping, current): + raise Error("must be overriden") + + """ + Returns the component installation directory if using a binary distribution + or the mapping directory if using a source distribution. + """ + def getInstallDir(self, mapping, current): + raise Error("must be overriden") + + def getPhpExtension(self, mapping, current): + raise Error("must be overriden if component provides php mapping") + + def getNugetPackage(self, mapping, compiler=None): + raise Error("must be overriden if component provides C++ or C# nuget packages") + + def getNugetPackageVersion(self, mapping): + raise Error("must be overriden if component provides C++ or C# nuget packages") + + def getFilters(self, mapping, config): + return ([], []) + + def canRun(self, testId, mapping, current): + return True + + def isMainThreadOnly(self, testId): + return True + + def getDefaultProcesses(self, mapping, processType, testId): + return None + + def getDefaultExe(self, mapping, processType, config): + return None + + def getDefaultSource(self, mapping, processType): + return None + + def getOptions(self, testcase, current): + return None + + def getRunOrder(self): + return [] + + def isCross(self, testId): + return False + + def getSliceDir(self, mapping, current): + installDir = self.getInstallDir(mapping, current) + if installDir.endswith(mapping.name): + installDir = installDir[0:len(installDir) - len(mapping.name) - 1] + if platform.getInstallDir() and installDir == platform.getInstallDir(): + return os.path.join(installDir, "share", "ice", "slice") + else: + return os.path.join(installDir, "slice") + + def getBinDir(self, process, mapping, current): + return platform._getBinDir(self, process, mapping, current) + + def getLibDir(self, process, mapping, current): + return platform._getLibDir(self, process, mapping, current) + + def getPhpIncludePath(self, mapping, current): + return "{0}/{1}".format(self.getInstallDir(mapping, current), "php" if self.useBinDist(mapping, current) else "lib") + + def _useBinDist(self, mapping, current, envName): + env = os.environ.get(envName, "").split() + return 'all' in env or mapping.name in env + + def _getInstallDir(self, mapping, current, envHomeName): + if self.useBinDist(mapping, current): + if isinstance(platform, Windows) or isinstance(mapping, CSharpMapping): + packageDir = platform.getNugetPackageDir(self, mapping, current) + if isinstance(mapping, CppMapping) and not os.path.exists(packageDir): + home = os.environ.get(envHomeName, "") + if not home or not os.path.exists(home): + raise RuntimeError("Cannot detect a valid C++ distribution") + return home + else: + return packageDir + else: + return os.environ.get(envHomeName, platform.getInstallDir()) + elif mapping: + return mapping.getPath() + else: + return toplevel class Platform: @@ -91,6 +175,9 @@ class Platform: except: self.nugetPackageCache = None + def hasDotNet(self): + return self.nugetPackageCache != None + def parseBuildVariables(self, variables): # Run make to get the values of the given variables output = run('make print V="{0}"'.format(" ".join(variables.keys())), cwd = toplevel) @@ -102,27 +189,26 @@ class Platform: value = match.group(2).strip() or "" setattr(self, varname, valuefn(value) if valuefn else value) - def getFilters(self, config): - if config.buildConfig in ["static", "cpp11-static"]: - return (["Ice/.*", "IceSSL/configuration", "IceDiscovery/simple", "IceGrid/simple", "Glacier2/application"], - ["Ice/library", "Ice/plugin"]) - return ([], []) - def getDefaultBuildPlatform(self): return self.supportedPlatforms[0] def getDefaultBuildConfig(self): return self.supportedConfigs[0] - def getBinSubDir(self, mapping, process, current): - # Return the bin sub-directory for the given mapping,platform,config, - # to be overriden by specializations - return "bin" + def _getBinDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + if isinstance(mapping, CSharpMapping): + if component.useBinDist(mapping, current): + return os.path.join(installDir, "tools", "netcoreapp2.0") + else: + return os.path.join(installDir, "bin", "netcoreapp2.0") + return os.path.join(installDir, "bin") - def getLibSubDir(self, mapping, process, current): - # Return the bin sub-directory for the given mapping,platform,config, - # to be overriden by specializations - return "lib" + def _getLibDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + if isinstance(mapping, CSharpMapping): + return os.path.join(installDir, "lib", "netstandard2.0") + return os.path.join(installDir, "lib") def getBuildSubDir(self, mapping, name, current): # Return the build sub-directory, to be overriden by specializations @@ -133,76 +219,31 @@ class Platform: def getLdPathEnvName(self): return "LD_LIBRARY_PATH" - def getInstallDir(self, mapping, current, envName): - return os.environ.get(envName, "/usr") + def getInstallDir(self): + return "/usr" - def getIceInstallDir(self, mapping, current): - # - # For .NET Core with Ice binary distribution the NuGet packages is - # installed in the global packages package cache - # - if isinstance(mapping, CSharpMapping) and current.driver.useIceBinDist(mapping) and current.config.netframework: - return os.path.join(self.nugetPackageCache, "zeroc.ice.net", self.getNugetPackageVersion(mapping)) - else: - return self.getInstallDir(mapping, current, "ICE_HOME") - - def getSliceDir(self, iceDir): - if iceDir.startswith("/usr"): - return os.path.join(iceDir, "share", "ice", "slice") - else: - return os.path.join(iceDir, "slice") - - def getDefaultExe(self, name, config): - if name == "icebox" and config.cpp11: - name += "++11" - return name + def getNugetPackageDir(self, component, mapping, current): + if not self.nugetPackageCache: + return None + return os.path.join(self.nugetPackageCache, component.getNugetPackage(mapping), component.getNugetPackageVersion(mapping)) def hasOpenSSL(self): # This is used by the IceSSL test suite to figure out how to setup certificates return False - def canRun(self, mapping, current): - return True - - def getDotnetExe(self): + def getDotNetExe(self): return "dotnet" - def getNugetPackageVersion(self, mapping): - version = None - if isinstance(mapping, CSharpMapping): - with open(os.path.join(toplevel, "csharp", "msbuild", "zeroc.ice.net.nuspec"), "r") as configFile: - version = re.search("<version>(.*)</version>", configFile.read()).group(1) - else: - with open(os.path.join(toplevel, "config", "icebuilder.props"), "r") as configFile: - version = re.search("<IceJSONVersion>(.*)</IceJSONVersion>", configFile.read()).group(1) - return version - class Darwin(Platform): - def getFilters(self, config): - if config.buildPlatform in ["iphoneos", "iphonesimulator", "macosx"] and "xcodesdk" in config.buildConfig: - return (["Ice/.*", "IceSSL/configuration"], - ["Ice/background", - "Ice/echo", - "Ice/faultTolerance", - "Ice/gc", - "Ice/library", - "Ice/logger", - "Ice/properties", - "Ice/plugin", - "Ice/stringConverter", - "Ice/threadPoolPriority", - "Ice/udp"]) - return Platform.getFilters(self, config) - def getDefaultBuildPlatform(self): return "macosx" def getLdPathEnvName(self): return "DYLD_LIBRARY_PATH" - def getInstallDir(self, mapping, current, envName): - return os.environ.get(envName, "/usr/local") + def getInstallDir(self): + return "/usr/local" class AIX(Platform): @@ -226,24 +267,32 @@ class Linux(Platform): def hasOpenSSL(self): return True - def getBinSubDir(self, mapping, process, current): + def _getBinDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + if isinstance(mapping, CSharpMapping): + return Platform._getBinDir(self, installDir, process, mapping, current) + buildPlatform = current.driver.configs[mapping].buildPlatform if self.linuxId in ["ubuntu", "debian"] and buildPlatform in self.foreignPlatforms: - return os.path.join("bin", self.multiArch[buildPlatform]) - return "bin" + return os.path.join(installDir, "bin", self.multiArch[buildPlatform]) + return os.path.join(installDir, "bin") + + def _getLibDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + if isinstance(mapping, CSharpMapping): + return Platform._getLibDir(self, installDir, process, mapping, current) - def getLibSubDir(self, mapping, process, current): buildPlatform = current.driver.configs[mapping].buildPlatform # PHP module is always installed in the lib directory for the default build platform if isinstance(mapping, PhpMapping) and buildPlatform == self.getDefaultBuildPlatform(): - return "lib" + return os.path.join(installDir, "lib") if self.linuxId in ["centos", "rhel", "fedora"]: - return "lib64" if buildPlatform == "x64" else "lib" + return os.path.join(installDir, "lib64" if buildPlatform == "x64" else "lib") elif self.linuxId in ["ubuntu", "debian"]: - return os.path.join("lib", self.multiArch[buildPlatform]) - return "lib" + return os.path.join(installDir, "lib", self.multiArch[buildPlatform]) + return os.path.join(installDir, "lib") def getBuildSubDir(self, mapping, name, current): buildPlatform = current.driver.configs[mapping].buildPlatform @@ -253,24 +302,8 @@ class Linux(Platform): else: return os.path.join("build", buildPlatform, buildConfig) - def getDefaultExe(self, name, config): - if name == "icebox": - if self.linuxId in ["centos", "rhel", "fedora"] and config.buildPlatform == "x86": - name += "32" # Multilib platform - if config.cpp11: - name += "++11" - return name - - def canRun(self, mapping, current): - if self.linuxId in ["centos", "rhel", "fedora"] and current.config.buildPlatform == "x86": - # - # Don't test Glacier2/IceStorm/IceGrid services with multilib platforms. We only - # build services for the native platform. - # - parent = re.match(r'^([\w]*).*', current.testcase.getTestSuite().getId()).group(1) - if parent in ["Glacier2", "IceStorm", "IceGrid"]: - return False - return Platform.canRun(self, mapping, current) + def getLinuxId(self): + return self.linuxId class Windows(Platform): @@ -278,36 +311,6 @@ class Windows(Platform): Platform.__init__(self) self.compiler = None - def getFilters(self, config): - if config.uwp: - return (["cpp/Ice/.*", "cpp/IceSSL/configuration"], - ["Ice/background", - "Ice/echo", - "Ice/faultTolerance", - "Ice/gc", - "Ice/library", - "Ice/logger", - "Ice/networkProxy", # SOCKS proxy not supported with UWP - "Ice/properties", # Property files are not supported with UWP - "Ice/plugin", - "Ice/threadPoolPriority"]) - elif self.getCompiler() in ["VC100"]: - return (["cpp/Ice/.*", - "cpp/IceSSL/.*", - "cpp/IceBox/.*", - "cpp/IceDiscovery/.*", - "cpp/IceUtil/.*", - "cpp/Slice/.*"], []) - else: - iceBinDist = os.environ.get("ICE_BIN_DIST", "").split() - exclude = ["ruby"] - if not 'all' in iceBinDist: - if not 'python' in iceBinDist and not self.getCompiler() in ["VC140"]: - exclude.append("python") - if not 'php' in iceBinDist and not self.getCompiler() in ["VC140"]: - exclude.append("php") - return ([], exclude) - def parseBuildVariables(self, variables): pass # Nothing to do, we don't support the make build system on Windows @@ -344,51 +347,44 @@ class Windows(Platform): def getPlatformToolset(self): return self.getCompiler().replace("VC", "v") - def getBinSubDir(self, mapping, process, current): - # - # Platform/Config taget bin directories. - # + def _getBinDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) platform = current.driver.configs[mapping].buildPlatform - buildConfig = current.driver.configs[mapping].buildConfig - config = "Debug" if buildConfig.find("Debug") >= 0 else "Release" - - if current.config.uwp and not current.config.protocol in ["ssl", "wss"]: - return "" - elif current.driver.useIceBinDist(mapping): - version = self.getNugetPackageVersion(mapping) - packageSuffix = self.getPlatformToolset() if isinstance(mapping, CppMapping) else "net" - package = os.path.join(mapping.path, "msbuild", "packages", "{0}".format( - mapping.getNugetPackage(packageSuffix, version))) if hasattr(mapping, "getNugetPackage") else None - nuget = package and os.path.exists(package) - iceHome = os.environ.get("ICE_HOME", "") - if isinstance(mapping, CppMapping) and not nuget and not os.path.exists(iceHome): - raise RuntimeError("Cannot detect a valid C++ distribution") - if not nuget: - return "bin" - elif isinstance(mapping, CSharpMapping) or isinstance(process, SliceTranslator): - return os.path.join("tools") + config = "Debug" if current.driver.configs[mapping].buildConfig.find("Debug") >= 0 else "Release" + if component.useBinDist(mapping, current): + if installDir != self.getNugetPackageDir(component, mapping, current): + return os.path.join(installDir, "bin") + elif isinstance(process, SliceTranslator): + return os.path.join(installDir, "tools") + elif isinstance(mapping, CSharpMapping): + return os.path.join(installDir, "tools", current.config.netframework or "net45") + elif process.isReleaseOnly(): + # Some services are only available in release mode in the Nuget package + return os.path.join(installDir, "build", "native", "bin", platform, "Release") else: - - # - # With Windows binary distribution some binaries are only included for Release configuration. - # - binaries = [Glacier2Router, IcePatch2Calc, IcePatch2Client, IcePatch2Server, IceBoxAdmin, IceBridge, - IceStormAdmin, IceGridAdmin] - config = next(("Release" for p in binaries if isinstance(process, p)), config) - - return os.path.join("build", "native", "bin", platform, config) + return os.path.join(installDir, "build", "native", "bin", platform, config) else: - if isinstance(mapping, CppMapping): - return os.path.join("bin", platform, config) + if isinstance(mapping, CSharpMapping): + return os.path.join(installDir, "bin", current.config.netframework or "net45") elif isinstance(mapping, PhpMapping): - return os.path.join("msbuild", "packages", "zeroc.ice.v140.{0}".format(self.getNugetPackageVersion(mapping)), + return os.path.join(self.getNugetPackageDir(component, mapping, current), "build", "native", "bin", platform, config) - return "bin" + else: + return os.path.join(installDir, "bin", platform, config) - def getLibSubDir(self, mapping, process, current): - if isinstance(mapping, PhpMapping): - return "php" if current.driver.useIceBinDist(mapping) else "lib" - return self.getBinSubDir(mapping, process, current) + def _getLibDir(self, component, process, mapping, current): + installDir = component.getInstallDir(mapping, current) + if isinstance(mapping, CSharpMapping): + return os.path.join(installDir, "lib", "netstandard2.0" if current.config.netframework else "net45") + else: + platform = current.driver.configs[mapping].buildPlatform + config = "Debug" if current.driver.configs[mapping].buildConfig.find("Debug") >= 0 else "Release" + if isinstance(mapping, PhpMapping): + return os.path.join(installDir, "lib", platform, config) + elif component.useBinDist(mapping, current): + return os.path.join(installDir, "build", "native", "bin", platform, config) + else: + return os.path.join(installDir, "bin", platform, config) def getBuildSubDir(self, mapping, name, current): buildPlatform = current.driver.configs[mapping].buildPlatform @@ -401,45 +397,26 @@ class Windows(Platform): def getLdPathEnvName(self): return "PATH" - def getInstallDir(self, mapping, current, envName): - - platform = current.config.buildPlatform - config = "Debug" if current.config.buildConfig.find("Debug") >= 0 else "Release" - version = self.getNugetPackageVersion(mapping) - packageSuffix = self.getPlatformToolset() if isinstance(mapping, CppMapping) else "net" - package = None + def getInstallDir(self): + return None # No default installation directory on Windows - if isinstance(mapping, CSharpMapping) and current.config.netframework: - # - # Use NuGet package from nuget locals - # - package = os.path.join(self.nugetPackageCache, "zeroc.ice.net", version) - elif hasattr(mapping, "getNugetPackage"): - package = os.path.join(mapping.path, "msbuild", "packages", mapping.getNugetPackage(packageSuffix, version)) - - home = os.environ.get(envName, "") - if isinstance(mapping, CppMapping) and not package and not os.path.exists(home): - raise RuntimeError("Cannot detect a valid C++ distribution") - - return package if package and os.path.exists(package) else home - - def canRun(self, mapping, current): - # - # On Windows, if testing with a binary distribution, don't test Glacier2/IceBridge services - # with the Debug configurations since we don't provide binaries for them. - # - if current.driver.useIceBinDist(mapping): - parent = re.match(r'^([\w]*).*', current.testcase.getTestSuite().getId()).group(1) - if parent in ["Glacier2", "IceBridge"] and current.config.buildConfig.find("Debug") >= 0: - return False - return Platform.canRun(self, mapping, current) + def getNugetPackageDir(self, component, mapping, current): + if isinstance(mapping, CSharpMapping) and current.config.netframework == "netcoreapp2.0": + return Platform.getNugetPackageDir(self, component, mapping, current) + else: + package = "{0}.{1}".format(component.getNugetPackage(mapping, self.getPlatformToolset()), + component.getNugetPackageVersion(mapping)) + return os.path.join(mapping.path, "msbuild", "packages", package) - def getDotnetExe(self): + def getDotNetExe(self): try: return run("where dotnet").strip() except: return None +# +# Instantiate platform global variable +# platform = None if sys.platform == "darwin": platform = Darwin() @@ -449,7 +426,6 @@ elif sys.platform.startswith("linux") or sys.platform.startswith("gnukfreebsd"): platform = Linux() elif sys.platform == "win32" or sys.platform[:6] == "cygwin": platform = Windows() - if not platform: print("can't run on unknown platform `{0}'".format(sys.platform)) sys.exit(1) @@ -486,30 +462,17 @@ def parseOptions(obj, options, mapped={}): remaining.append((o, a)) options[:] = remaining +""" +Mapping abstract class. The mapping class provides mapping specific information. +Multiple components can share the same mapping rules as long as the layout is +similar. +""" class Mapping: mappings = OrderedDict() class Config: - # All option values for Ice/IceBox tests. - coreOptions = { - "protocol" : ["tcp", "ssl", "wss", "ws"], - "compress" : [False, True], - "ipv6" : [False, True], - "serialize" : [False, True], - "mx" : [False, True], - } - - # All option values for IceGrid/IceStorm/Glacier2/IceDiscovery tests. - serviceOptions = { - "protocol" : ["tcp", "wss"], - "compress" : [False, True], - "ipv6" : [False, True], - "serialize" : [False, True], - "mx" : [False, True], - } - @classmethod def getSupportedArgs(self): return ("", ["config=", "platform=", "protocol=", "compress", "ipv6", "no-ipv6", "serialize", "mx", @@ -634,17 +597,10 @@ class Mapping: yield self.__class__(options) - options = None - parent = re.match(r'^([\w]*).*', testcase.getTestSuite().getId()).group(1) - if isinstance(testcase, ClientServerTestCase) and parent in ["Ice", "IceBox"]: - options = current.driver.filterOptions(testcase, self.coreOptions) - elif parent in ["IceGrid", "Glacier2", "IceStorm", "IceDiscovery", "IceBridge"]: - options = current.driver.filterOptions(testcase, self.serviceOptions) - - return [c for c in gen(options)] + return [c for c in gen(current.driver.filterOptions(component.getOptions(testcase, current)))] - def canRun(self, current): - if not platform.canRun(current.testcase.getMapping(), current): + def canRun(self, testId, current): + if not component.canRun(testId, current.testcase.getMapping(), current): return False options = {} @@ -765,11 +721,14 @@ class Mapping: self.mappings[name] = mapping.init(name) @classmethod + def remove(self, name): + del self.mappings[name] + + @classmethod def getAll(self, driver=None): return [m for m in self.mappings.values() if not driver or driver.matchLanguage(str(m))] def __init__(self, path=None): - self.platform = None self.name = None self.path = os.path.abspath(path) if path else None self.testsuites = {} @@ -787,20 +746,18 @@ class Mapping: return self.Config(options) def filterTestSuite(self, testId, config, filters=[], rfilters=[]): - (pfilters, prfilters) = platform.getFilters(config) - for includes in [filters, [re.compile(pf) for pf in pfilters]]: - if len(includes) > 0: - for f in includes: - if f.search(self.name + "/" + testId): - break - else: + if len(filters) > 0: + for f in filters: + if f.search(self.name + "/" + testId): + break + else: + return True + + if len(rfilters) > 0: + for f in rfilters: + if f.search(self.name + "/" + testId): return True - for excludes in [rfilters, [re.compile(pf) for pf in prfilters]]: - if len(excludes) > 0: - for f in excludes: - if f.search(self.name + "/" + testId): - return True return False def loadTestSuites(self, tests, config, filters=[], rfilters=[]): @@ -865,7 +822,6 @@ class Mapping: def computeTestCases(self, testId, files): # Instantiate a new test suite if the directory contains well-known source files. - def checkFile(f, m): try: # If given mapping is same as local mapping, just check the files set, otherwise check @@ -909,27 +865,35 @@ class Mapping: return current.testcase.getPath() def getDefaultSource(self, processType): - return processType + defaultSource = component.getDefaultSource(self, processType) + if defaultSource: + return defaultSource + return self._getDefaultSource(processType) def getDefaultProcesses(self, processType, testsuite): + defaultProcesses = component.getDefaultProcesses(self, processType, testsuite.getId()) + if defaultProcesses: + return defaultProcesses + return self._getDefaultProcesses(processType, testsuite) + + def getDefaultExe(self, processType, config=None): + defaultExe = component.getDefaultExe(self, processType, config) + if defaultExe: + return defaultExe + return self._getDefaultExe(processType, config) + + def _getDefaultSource(self, processType): + return processType + + def _getDefaultProcesses(self, processType, testsuite): # # If no server or client is explicitly set with a testcase, getDefaultProcess is called # to figure out which process class to instantiate. Based on the processType and the testsuite # we instantiate the right default process class. # - if processType is None: - return [] - elif testsuite.getId().startswith("IceUtil") or testsuite.getId().startswith("Slice"): - return [SimpleClient()] - elif testsuite.getId().startswith("IceGrid"): - if processType in ["client", "collocated"]: - return [IceGridClient()] - if processType in ["server", "serveramd"]: - return [IceGridServer()] - else: - return [Server()] if processType in ["server", "serveramd"] else [Client()] + return [Server()] if processType in ["server", "serveramd"] else [Client()] if processType else [] - def getDefaultExe(self, processType, config): + def _getDefaultExe(self, processType, config): return processType def getClientMapping(self, testId=None): @@ -940,12 +904,6 @@ class Mapping: # Can be overridden for client-only mapping that relies on another mapping for servers return self - def getBinDir(self, process, current): - return os.path.join(current.driver.getIceDir(self, current), platform.getBinSubDir(self, process, current)) - - def getLibDir(self, process, current): - return os.path.join(current.driver.getIceDir(self, current), platform.getLibSubDir(self, process, current)) - def getBuildDir(self, name, current): return platform.getBuildSubDir(self, name, current) @@ -954,7 +912,7 @@ class Mapping: if process.isFromBinDir(): # If it's a process from the bin directory, the location is platform specific # so we check with the platform. - cmd = os.path.join(self.getBinDir(process, current), exe) + cmd = os.path.join(component.getBinDir(process, self, current), exe) elif current.testcase: # If it's a process from a testcase, the binary is in the test build directory. cmd = os.path.join(current.testcase.getPath(), current.getBuildDir(exe), exe) @@ -1000,27 +958,6 @@ class Mapping: def getOptions(self, current): return {} - def getRunOrder(self): - return ["Slice", "IceUtil", "Ice", "IceSSL", "IceBox", "Glacier2", "IceGrid", "IceStorm"] - - def getCrossTestSuites(self): - return [ - "Ice/ami", - "Ice/info", - "Ice/exceptions", - "Ice/enums", - "Ice/facets", - "Ice/inheritance", - "Ice/invoke", - "Ice/objects", - "Ice/operations", - "Ice/proxy", - "Ice/servantLocator", - "Ice/slicing/exceptions", - "Ice/slicing/objects", - "Ice/optional" - ] - # # A Runnable can be used as a "client" for in test cases, it provides # implements run, setup and teardown methods. @@ -1243,6 +1180,9 @@ class Process(Runnable): def isFromBinDir(self): return False + def isReleaseOnly(self): + return False + def getArgs(self, current): return [] @@ -1329,7 +1269,26 @@ class ProcessFromBinDir: def isFromBinDir(self): return True -class SliceTranslator(ProcessFromBinDir, SimpleClient): +# +# Executables for processes inheriting this marker class are looked up in the +# Ice distribution bin directory. +# +class ProcessFromBinDir: + + def isFromBinDir(self): + return True + +# +# Executables for processes inheriting this marker class are only provided +# as a Release executble on Windows +# +class ProcessIsReleaseOnly: + + def isReleaseOnly(self): + return True + + +class SliceTranslator(ProcessFromBinDir, ProcessIsReleaseOnly, SimpleClient): def __init__(self, translator): SimpleClient.__init__(self, exe=translator, quiet=True, mapping=Mapping.getByName("cpp")) @@ -1847,10 +1806,9 @@ class TestSuite: def isMainThreadOnly(self, driver): for m in [CppMapping, JavaMapping, CSharpMapping]: config = driver.configs[self.mapping] - # TODO: WORKAROUND for ICE-8175 - if self.id.startswith("IceStorm"): + if component.isMainThreadOnly(self.id): return True - elif isinstance(self.mapping, AndroidMapping) or isinstance(self.mapping, AndroidCompatMapping): + elif isinstance(self.mapping, AndroidMappingMixin): return True elif isinstance(self.mapping, m): if "iphone" in config.buildPlatform or config.uwp: @@ -1892,10 +1850,6 @@ class TestSuite: def isMultiHost(self): return self.multihost - def isCross(self): - # Only run the tests that support cross testing --all-cross or --cross - return self.id in self.mapping.getCrossTestSuites() - class ProcessController: def __init__(self, current): @@ -1955,8 +1909,6 @@ class LocalProcessController(ProcessController): "testcase": current.testcase, "testdir": current.testsuite.getPath(), "builddir": current.getBuildDir(process.getExe(current)), - "icedir" : current.driver.getIceDir(current.testcase.getMapping(), current), - "iceboxconfigext": "" if not current.config.netframework else ".{0}".format(current.config.netframework) } traceFile = "" @@ -2115,7 +2067,7 @@ class RemoteProcessController(ProcessController): try: proxy.ice_ping() except Exception as ex: - raise RuntimeError("couldn't reach the remote controller `{0}'".format(proxy)) + raise RuntimeError("couldn't reach the remote controller `{0}': {1}".format(proxy, ex)) with self.cond: self.processControllerProxies[ident] = proxy @@ -2238,7 +2190,7 @@ class AndroidProcessController(RemoteProcessController): raise RuntimeError("cannot find free port in range 5554-5584, to run android emulator") self.device = "emulator-{}".format(port) - cmd = "emulator -avd {0} -port {1} -noaudio -no-window -no-snapshot".format(avd, port) + cmd = "emulator -avd {0} -port {1} -noaudio -partition-size 768 -no-window -no-snapshot".format(avd, port) self.emulator = subprocess.Popen(cmd, shell=True) if self.emulator.poll(): @@ -2748,12 +2700,12 @@ class Driver: return list(self.drivers.values()) @classmethod - def create(self, options): + def create(self, options, component): parseOptions(self, options) driver = self.drivers.get(self.driver) if not driver: raise RuntimeError("unknown driver `{0}'".format(self.driver)) - return driver(options) + return driver(options, component) @classmethod def getSupportedArgs(self): @@ -2781,8 +2733,9 @@ class Driver: print("--controller-app Start the process controller application.") print("--valgrind Start executables with valgrind.") - def __init__(self, options): + def __init__(self, options, component): self.debug = False + component = component self.filters = [] self.rfilters = [] self.host = "" @@ -2793,8 +2746,8 @@ class Driver: self.languages = ",".join(os.environ.get("LANGUAGES", "").split(" ")) self.languages = [self.languages] if self.languages else [] self.rlanguages = [] - self.failures = [] + parseOptions(self, options, { "d": "debug", "r" : "filters", "R" : "rfilters", @@ -2804,13 +2757,13 @@ class Driver: "host-bt" : "hostBT", "controller-app" : "controllerApp"}) - self.filters = [re.compile(a) for a in self.filters] - self.rfilters = [re.compile(a) for a in self.rfilters] if self.languages: self.languages = [i for sublist in [l.split(",") for l in self.languages] for i in sublist] if self.rlanguages: self.rlanguages = [i for sublist in [l.split(",") for l in self.rlanguages] for i in sublist] + (self.filters, self.rfilters) = ([re.compile(a) for a in self.filters], [re.compile(a) for a in self.rfilters]) + self.communicator = None self.interface = "" self.processControllers = {} @@ -2818,29 +2771,11 @@ class Driver: def setConfigs(self, configs): self.configs = configs - def useIceBinDist(self, mapping): - return self.useBinDist(mapping, "ICE_BIN_DIST") - - def getIceDir(self, mapping, current): - return self.getInstallDir(mapping, current, "ICE_HOME", "ICE_BIN_DIST") - - def useBinDist(self, mapping, envName): - env = os.environ.get(envName, "").split() - return 'all' in env or mapping.name in env - - def getInstallDir(self, mapping, current, envHomeName, envBinDistName): - if self.useBinDist(mapping, envBinDistName): - if envHomeName == "ICE_HOME": - return platform.getIceInstallDir(mapping, current) - else: - return platform.getInstallDir(mapping, current, envHomeName) - elif mapping: - return mapping.getPath() - else: - return toplevel - - def getSliceDir(self, mapping, current): - return platform.getSliceDir(self.getIceDir(mapping, current) if self.useIceBinDist(mapping) else toplevel) + def getFilters(self, mapping, config): + # Return the driver and component filters + (filters, rfilters) = component.getFilters(mapping, config) + (filters, rfilters) = ([re.compile(a) for a in filters], [re.compile(a) for a in rfilters]) + return (self.filters + filters, self.rfilters + rfilters) def isWorkerThread(self): return False @@ -2912,9 +2847,9 @@ class Driver: initData.properties.setProperty("IceDiscovery.Interface", self.interface) initData.properties.setProperty("Ice.Default.Host", self.interface) initData.properties.setProperty("Ice.ThreadPool.Server.Size", "10") - #initData.properties.setProperty("Ice.Trace.Protocol", "1") - #initData.properties.setProperty("Ice.Trace.Network", "3") - #initData.properties.setProperty("Ice.StdErr", "allTests.log") + # initData.properties.setProperty("Ice.Trace.Protocol", "1") + # initData.properties.setProperty("Ice.Trace.Network", "3") + # initData.properties.setProperty("Ice.StdErr", "allTests.log") initData.properties.setProperty("Ice.Override.Timeout", "10000") initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000") self.communicator = Ice.initialize(initData) @@ -2933,8 +2868,7 @@ class Driver: processController = UWPProcessController elif process and isinstance(process.getMapping(current), JavaScriptMapping) and current.config.browser: processController = BrowserProcessController - elif process and (isinstance(process.getMapping(current), AndroidMapping) or - isinstance(process.getMapping(current), AndroidCompatMapping)): + elif process and isinstance(process.getMapping(current), AndroidMappingMixin): processController = AndroidProcessController else: processController = LocalProcessController @@ -2986,28 +2920,6 @@ class CppMapping(Mapping): parseOptions(self, options, { "cpp-config" : "buildConfig", "cpp-platform" : "buildPlatform" }) - def canRun(self, current): - if not Mapping.Config.canRun(self, current): - return False - - # No C++11 tests for IceStorm, IceGrid, etc - if self.cpp11: - testId = current.testcase.getTestSuite().getId() - parent = re.match(r'^([\w]*).*', testId).group(1) - if parent in ["IceStorm", "IceBridge"]: - return False - elif parent in ["IceGrid"] and testId not in ["IceGrid/simple"]: - return False - elif parent in ["Glacier2"] and testId not in ["Glacier2/application", "Glacier2/sessionHelper"]: - return False - return True - - def getNugetPackage(self, compiler, version): - return "zeroc.ice.{0}.{1}".format(compiler, version) - - def getDefaultExe(self, processType, config): - return platform.getDefaultExe(processType, config) - def getOptions(self, current): return { "compress" : [False] } if current.config.uwp else {} @@ -3028,10 +2940,9 @@ class CppMapping(Mapping): "IceSSL.CertFile": "server.p12" if server else "ms-appx:///client.p12" if uwp else "client.p12" }) if isinstance(platform, Darwin): - keychainFile = "server.keychain" if server else "client.keychain" props.update({ "IceSSL.KeychainPassword" : "password", - "IceSSL.Keychain": keychainFile + "IceSSL.Keychain": "server.keychain" if server else "client.keychain" }) return props @@ -3057,7 +2968,7 @@ class CppMapping(Mapping): # On most platforms, we also need to add the library directory to the library path environment variable. # if not isinstance(platform, Darwin): - libPaths.append(self.getLibDir(process, current)) + libPaths.append(component.getLibDir(process, self, current)) # # Add the test suite library directories to the platform library path environment variable. @@ -3071,7 +2982,7 @@ class CppMapping(Mapping): env[platform.getLdPathEnvName()] = os.pathsep.join(libPaths) return env - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.cpp", "server" : "Server.cpp", @@ -3119,17 +3030,15 @@ class JavaMapping(Mapping): def getTestsPath(self): return os.path.join(self.path, "test/src/main/java/test") - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return self.getDefaultExe(processType) + ".java" - def getDefaultExe(self, processType, config=None): + def _getDefaultExe(self, processType, config=None): return { "client" : "Client", "server" : "Server", "serveramd" : "AMDServer", "collocated" : "Collocated", - "icebox": "com.zeroc.IceBox.Server", - "iceboxadmin" : "com.zeroc.IceBox.Admin", }[processType] class JavaCompatMapping(JavaMapping): @@ -3142,41 +3051,15 @@ class JavaCompatMapping(JavaMapping): "IceLocatorDiscovery" : "IceLocatorDiscovery.PluginFactory" }[plugin] - def getDefaultExe(self, processType, config=None): + def _getDefaultExe(self, processType, config=None): return { "client" : "Client", "server" : "Server", "serveramd" : "AMDServer", "collocated" : "Collocated", - "icebox": "IceBox.Server", - "iceboxadmin" : "IceBox.Admin", }[processType] -class Android: - - @classmethod - def getUnsuportedTests(self, protocol): - tests = [ - "Ice/hash", - "Ice/faultTolerance", - "Ice/metrics", - "Ice/networkProxy", - "Ice/throughput", - "Ice/plugin", - "Ice/logger", - "Ice/properties"] - if protocol in ["ssl", "wss"]: - tests += [ - "Ice/binding", - "Ice/timeout", - "Ice/udp"] - if protocol in ["bt", "bts"]: - tests += [ - "Ice/info", - "Ice/udp"] - return tests - -class AndroidMapping(JavaMapping): +class AndroidMappingMixin(): class Config(Mapping.Config): @@ -3198,8 +3081,11 @@ class AndroidMapping(JavaMapping): parseOptions(self, options) self.androidemulator = self.androidemulator or self.avd + def __init__(self, baseclass): + self.baseclass = baseclass + def getSSLProps(self, process, current): - props = JavaMapping.getSSLProps(self, process, current) + props = super(baseclass, self).getSSLProps(self, process, current) props.update({ "IceSSL.KeystoreType" : "BKS", "IceSSL.TruststoreType" : "BKS", @@ -3213,55 +3099,20 @@ class AndroidMapping(JavaMapping): def getCommonTestsPath(self): return os.path.join(self.path, "..", "..", "scripts", "tests") - def filterTestSuite(self, testId, config, filters=[], rfilters=[]): - if not testId.startswith("Ice/") or testId in Android.getUnsuportedTests(config.protocol): - return True - return JavaMapping.filterTestSuite(self, testId, config, filters, rfilters) +class AndroidMapping(AndroidMappingMixin, JavaMapping): # Note: the inheritance order is important + + def __init__(self): + JavaMapping.__init__(self) + AndroidMappingMixin.__init__(self, JavaMapping) def getSDKPackage(self): return "system-images;android-25;google_apis;x86_64" -class AndroidCompatMapping(JavaCompatMapping): - - class Config(Mapping.Config): - - @classmethod - def getSupportedArgs(self): - return ("", ["device=", "avd=", "androidemulator"]) - - @classmethod - def usage(self): - print("") - print("Android Mapping options:") - print("--device=<device-id> Id of the emulator or device used to run the tests.") - print("--androidemulator Run tests in emulator as opposed to a real device.") - print("--avd Start emulator image") - - def __init__(self, options=[]): - Mapping.Config.__init__(self, options) - - parseOptions(self, options) - self.androidemulator = self.androidemulator or self.avd +class AndroidCompatMapping(AndroidMappingMixin, JavaCompatMapping): # Note: the inheritance order is important - def getSSLProps(self, process, current): - props = JavaCompatMapping.getSSLProps(self, process, current) - props.update({ - "IceSSL.KeystoreType" : "BKS", - "IceSSL.TruststoreType" : "BKS", - "Ice.InitPlugins" : "0", - "IceSSL.Keystore": "server.bks" if isinstance(process, Server) else "client.bks"}) - return props - - def getTestsPath(self): - return os.path.join(self.path, "../test/src/main/java/test") - - def getCommonTestsPath(self): - return os.path.join(self.path, "..", "..", "scripts", "tests") - - def filterTestSuite(self, testId, config, filters=[], rfilters=[]): - if not testId.startswith("Ice/") or testId in Android.getUnsuportedTests(config.protocol): - return True - return JavaCompatMapping.filterTestSuite(self, testId, config, filters, rfilters) + def __init__(self): + JavaCompatMapping.__init__(self) + AndroidMappingMixin.__init__(self, JavaCompatMapping) def getSDKPackage(self): return "system-images;android-21;google_apis;x86_64" @@ -3297,31 +3148,6 @@ class CSharpMapping(Mapping): else: self.netframework = "" if isinstance(platform, Windows) else "netcoreapp2.0" - def canRun(self, current): - testId = current.testcase.getTestSuite().getId() - if not Mapping.Config.canRun(self, current): - return False - - if self.netframework: - # - # The following tests require multicast, on Unix platforms it's currently only supported - # with IPv4 due to .NET Core bug https://github.com/dotnet/corefx/issues/25525 - # - if not isinstance(platform, Windows) and self.ipv6 and testId in ["Ice/udp", - "IceDiscovery/simple", - "IceGrid/simple"]: - return False - - if isinstance(platform, Darwin): - if "IceSSL" in testId or "IceDiscovery" in testId: - return False - - # TODO: Remove once https://github.com/dotnet/corefx/issues/28759 is fixed - if testId == "Ice/adapterDeactivation" and self.protocol in ["ssl", "wss"]: - return False - - return True - def getBuildDir(self, name, current): if current.config.netframework: return os.path.join("msbuild", name, "netstandard2.0", current.config.netframework) @@ -3340,12 +3166,7 @@ class CSharpMapping(Mapping): return props def getPluginEntryPoint(self, plugin, process, current): - plugindir = "{0}/{1}".format(current.driver.getIceDir(self, current), "lib") - - if current.config.netframework: - plugindir = os.path.join(plugindir, "netstandard2.0") - else: - plugindir = os.path.join(plugindir, "net45") + plugindir = component.getLibDir(process, self, current) # # If the plug-in assemblie exists in the test directory, this is a good indication that the @@ -3367,21 +3188,17 @@ class CSharpMapping(Mapping): def getEnv(self, process, current): env = {} if isinstance(platform, Windows): - - if current.driver.useIceBinDist(self): - framework = "net45" if not current.config.netframework else current.config.netframework - env['PATH'] = os.path.join(platform.getIceInstallDir(self, current), "tools", framework) - if not current.config.netframework: - env['DEVPATH'] = os.path.join(platform.getIceInstallDir(self, current), "lib", "net45") + if component.useBinDist(self, current): + env['PATH'] = component.getBinDir(process, self, current) else: env['PATH'] = os.path.join(toplevel, "cpp", "msbuild", "packages", "bzip2.{0}.1.0.6.10".format(platform.getPlatformToolset()), "build", "native", "bin", "x64", "Release") - if not current.config.netframework: - env['DEVPATH'] = os.path.join(current.driver.getIceDir(self, current), "lib", "net45") + if not current.config.netframework: + env['DEVPATH'] = component.getLibDir(process, self, current) return env - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.cs", "server" : "Server.cs", @@ -3389,35 +3206,19 @@ class CSharpMapping(Mapping): "collocated" : "Collocated.cs", }[processType] - def getDefaultExe(self, processType, config): + def _getDefaultExe(self, processType, config): return processType - def getNugetPackage(self, compiler, version): - return "zeroc.ice.net.{0}".format(version) - def getCommandLine(self, current, process, exe, args): - cmd = "" - if current.config.netframework: - cmd = "dotnet " - if exe == "icebox": - if current.driver.useIceBinDist(self): - cmd += os.path.join(platform.getIceInstallDir(self, current), "tools", "netcoreapp2.0", "iceboxnet.dll") - else: - cmd += os.path.join(self.path, "bin", "netcoreapp2.0", "iceboxnet.dll") - else: - if current.config.netframework == "netcoreapp2.0": - cmd += os.path.join(current.testcase.getPath(), self.getBuildDir(exe, current), "{0}.dll".format(exe)) - else: - cmd += os.path.join(current.testcase.getPath(), self.getBuildDir(exe, current), "{0}".format(exe)) + if process.isFromBinDir(): + path = component.getBinDir(process, self, current) else: - if exe == "icebox": - if current.driver.useIceBinDist(self): - cmd = os.path.join(platform.getIceInstallDir(self, current), "tools", "net45", "iceboxnet.exe") - else: - cmd = os.path.join(self.path, "bin", "net45", "iceboxnet.exe") - else: - cmd = os.path.join(current.testcase.getPath(), self.getBuildDir(exe, current), exe) - return cmd + " " + args + path = os.path.join(current.testcase.getPath(), current.getBuildDir(exe)) + + if current.config.netframework == "netcoreapp2.0": + return "dotnet " + os.path.join(path, exe) + ".dll " + args + else: + return os.path.join(path, exe) + ".exe " + args class CppBasedMapping(Mapping): @@ -3451,15 +3252,12 @@ class CppBasedMapping(Mapping): def getEnv(self, process, current): env = Mapping.getEnv(self, process, current) - if current.driver.getIceDir(self, current) != platform.getIceInstallDir(self, current): + if not isinstance(platform, Darwin) and component.getInstallDir(self, current) != platform.getInstallDir(): # If not installed in the default platform installation directory, add - # the Ice C++ library directory to the library path - env[platform.getLdPathEnvName()] = Mapping.getByName("cpp").getLibDir(process, current) + # the C++ library directory to the library path + env[platform.getLdPathEnvName()] = component.getLibDir(process, Mapping.getByName("cpp"), current) return env - def getNugetPackage(self, compiler, version): - return "zeroc.ice.{0}.{1}".format(compiler, version) - class ObjCMapping(CppBasedMapping): def getTestSuites(self, ids=[]): @@ -3476,7 +3274,7 @@ class ObjCMapping(CppBasedMapping): Mapping.Config.__init__(self, options) self.arc = self.buildConfig.lower().find("arc") >= 0 - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.m", "server" : "Server.m", @@ -3494,10 +3292,10 @@ class PythonMapping(CppBasedMapping): def getEnv(self, process, current): env = CppBasedMapping.getEnv(self, process, current) - if current.driver.getIceDir(self, current) != platform.getIceInstallDir(self, current): + if component.getInstallDir(self, current) != platform.getInstallDir(): # If not installed in the default platform installation directory, add # the Ice python directory to PYTHONPATH - dirs = self.getPythonDirs(current.driver.getIceDir(self, current), current.config) + dirs = self.getPythonDirs(component.getInstallDir(self, current), current.config) env["PYTHONPATH"] = os.pathsep.join(dirs) return env @@ -3508,10 +3306,10 @@ class PythonMapping(CppBasedMapping): dirs.append(os.path.join(iceDir, "python")) return dirs - def getDefaultExe(self, processType, config): + def _getDefaultExe(self, processType, config): return self.getDefaultSource(processType) - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.py", "server" : "Server.py", @@ -3528,7 +3326,7 @@ class CppBasedClientMapping(CppBasedMapping): def getServerMapping(self, testId=None): return Mapping.getByName("cpp") # By default, run clients against C++ mapping executables - def getDefaultExe(self, processType, config): + def _getDefaultExe(self, processType, config): return self.getDefaultSource(processType) class RubyMapping(CppBasedClientMapping): @@ -3542,13 +3340,13 @@ class RubyMapping(CppBasedClientMapping): def getEnv(self, process, current): env = CppBasedMapping.getEnv(self, process, current) - if current.driver.getIceDir(self, current) != platform.getIceInstallDir(self, current): + if component.getInstallDir(self, current) != platform.getInstallDir(): # If not installed in the default platform installation directory, add # the Ice ruby directory to RUBYLIB env["RUBYLIB"] = os.path.join(self.path, "ruby") return env - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.rb" }[processType] class PhpMapping(CppBasedClientMapping): @@ -3560,43 +3358,34 @@ class PhpMapping(CppBasedClientMapping): def getCommandLine(self, current, process, exe, args): phpArgs = [] php = "php" + + # + # On Windows, when using a source distribution use the php executable from + # the Nuget PHP dependency. + # + if isinstance(platform, Windows) and not component.useBinDist(self, current): + buildPlatform = current.driver.configs[self].buildPlatform + buildConfig = "Debug" if current.driver.configs[self].buildConfig.find("Debug") >= 0 else "Release" + packageName = "php-7.1-ts.7.1.17" if buildConfig in ["Debug", "Release"] else "php-7.1-nts.7.1.17" + php = os.path.join(self.path, "msbuild", "packages", packageName, "build", "native", "bin", + buildPlatform, buildConfig, "php.exe") + # # If Ice is not installed in the system directory, specify its location with PHP # configuration arguments. # - if isinstance(platform, Windows): - systemInstall = current.driver.useIceBinDist(self) - else: - systemInstall = current.driver.getIceDir(self, current) == platform.getIceInstallDir(self, current) - - if not systemInstall: - if isinstance(platform, Windows): - buildPlatform = current.driver.configs[self].buildPlatform - buildConfig = current.driver.configs[self].buildConfig - packageName = "php-7.1-ts.7.1.17" if buildConfig in ["Debug", "Release"] else "php-7.1-nts.7.1.17" - extension = "php_ice.dll" if buildConfig in ["Debug", "Release"] else "php_ice_nts.dll" - buildConfig = "Debug" if current.driver.configs[self].buildConfig.find("Debug") >= 0 else "Release" - - php = os.path.join(self.path, "msbuild", "packages", packageName, "build", "native", "bin", - buildPlatform, buildConfig, "php.exe") - - extensionDir = os.path.join(self.path, "lib", buildPlatform, buildConfig) - includePath = self.getLibDir(process, current) - else: - useBinDist = current.driver.useIceBinDist(self) - extension = "ice.so" - extensionDir = self.getLibDir(process, current) - includePath = "{0}/{1}".format(current.driver.getIceDir(self, current), "php" if useBinDist else "lib") - + if isinstance(platform, Windows) and not component.useBinDist(self, current) or \ + platform.getInstallDir() and component.getInstallDir(self, current) != platform.getInstallDir(): phpArgs += ["-n"] # Do not load any php.ini files - phpArgs += ["-d", "extension_dir='{0}'".format(extensionDir)] - phpArgs += ["-d", "extension='{0}'".format(extension)] - phpArgs += ["-d", "include_path='{0}'".format(includePath)] + phpArgs += ["-d", "extension_dir='{0}'".format(component.getLibDir(process, self, current))] + phpArgs += ["-d", "extension='{0}'".format(component.getPhpExtension(self, current))] + phpArgs += ["-d", "include_path='{0}'".format(component.getPhpIncludePath(self, current))] + if hasattr(process, "getPhpArgs"): phpArgs += process.getPhpArgs(current) return "{0} {1} -f {2} -- {3}".format(php, " ".join(phpArgs), exe, args) - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.php" }[processType] class MatlabMapping(CppBasedClientMapping): @@ -3615,7 +3404,7 @@ class MatlabMapping(CppBasedClientMapping): def getServerMapping(self, testId=None): return Mapping.getByName("python") # Run clients against Python mapping servers - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "client.m" }[processType] def getOptions(self, current): @@ -3657,7 +3446,7 @@ class JavaScriptMapping(Mapping): def loadTestSuites(self, tests, config, filters, rfilters): Mapping.loadTestSuites(self, tests, config, filters, rfilters) - self.getServerMapping().loadTestSuites(list(self.testsuites.keys()) + ["Ice/echo"], config, filters, rfilters) + self.getServerMapping().loadTestSuites(list(self.testsuites.keys()) + ["Ice/echo"], config) def getServerMapping(self, testId=None): if testId and self.hasSource(testId, "server"): @@ -3665,10 +3454,10 @@ class JavaScriptMapping(Mapping): else: return Mapping.getByName("cpp") # Run clients against C++ mapping servers if no JS server provided - def getDefaultProcesses(self, processType, testsuite): + def _getDefaultProcesses(self, processType, testsuite): if processType in ["server", "serveramd"]: return [EchoServer(), Server()] - return Mapping.getDefaultProcesses(self, processType, testsuite) + return Mapping._getDefaultProcesses(self, processType, testsuite) def getCommandLine(self, current, process, exe, args): if current.config.es5: @@ -3676,11 +3465,11 @@ class JavaScriptMapping(Mapping): else: return "node {0}/test/Common/run.js {1} {2}".format(self.path, exe, args) - def getDefaultSource(self, processType): + def _getDefaultSource(self, processType): return { "client" : "Client.js", "serveramd" : "ServerAMD.js", "server" : "Server.js" }[processType] - def getDefaultExe(self, processType, config=None): - return self.getDefaultSource(processType).replace(".js", "") + def _getDefaultExe(self, processType, config=None): + return self._getDefaultSource(processType).replace(".js", "") def getEnv(self, process, current): env = Mapping.getEnv(self, process, current) @@ -3714,67 +3503,15 @@ class JavaScriptMapping(Mapping): } return options -try: - from Glacier2Util import * - from IceBoxUtil import * - from IceBridgeUtil import * - from IcePatch2Util import * - from IceGridUtil import * - from IceStormUtil import * -except ImportError: - pass - -from LocalDriver import * - # -# Supported mappings +# Import local driver # -for m in filter(lambda x: os.path.isdir(os.path.join(toplevel, x)), os.listdir(toplevel)): - if m == "cpp" or re.match("cpp-.*", m): - Mapping.add(m, CppMapping()) - elif m == "java-compat" or re.match("java-compat-.*", m): - Mapping.add(m, JavaCompatMapping()) - elif m == "java" or re.match("java-.*", m): - Mapping.add(m, JavaMapping()) - elif m == "python" or re.match("python-.*", m): - Mapping.add(m, PythonMapping()) - elif m == "ruby" or re.match("ruby-.*", m): - Mapping.add(m, RubyMapping()) - elif m == "php" or re.match("php-.*", m): - Mapping.add(m, PhpMapping()) - elif m == "js" or re.match("js-.*", m): - Mapping.add(m, JavaScriptMapping()) - elif m == "objective-c" or re.match("objective-c-*", m): - Mapping.add(m, ObjCMapping()) - -try: - if not isinstance(platform, Windows): - # - # Check if the .NET Core SDK is installed - # - run("dotnet --version") - Mapping.add("csharp", CSharpMapping()) -except: - pass - -# -# Check if the Android SDK is installed and eventually add the Android mappings -# -try: - run("adb version") - Mapping.add(os.path.join("java-compat", "android"), AndroidCompatMapping()) - Mapping.add(os.path.join("java", "android"), AndroidMapping()) -except: - pass +from LocalDriver import * # -# Check if Matlab is installed and eventually add the Matlab mapping +# Import component classes and instantiate the default component # -try: - run("where matlab" if isinstance(platform, Windows) else "which matlab") - Mapping.add("matlab", MatlabMapping()) -except: - pass +from Component import * def runTestsWithPath(path): runTests([Mapping.getByPath(path)]) @@ -3821,7 +3558,7 @@ def runTests(mappings=None, drivers=None): # # Create the driver # - driver = Driver.create(opts) + driver = Driver.create(opts, component) # # Create the configurations for each mapping. @@ -3841,7 +3578,8 @@ def runTests(mappings=None, drivers=None): # driver.setConfigs(configs) for mapping in mappings + driver.getMappings(): - mapping.loadTestSuites(args, configs[mapping], driver.filters, driver.rfilters) + (filters, rfilters) = driver.getFilters(mapping, configs[mapping]) + mapping.loadTestSuites(args, configs[mapping], filters, rfilters) # # Finally, run the test suites with the driver. diff --git a/scripts/tests/IceBox/admin.py b/scripts/tests/IceBox/admin.py index 93d47189989..c194e32bf99 100644 --- a/scripts/tests/IceBox/admin.py +++ b/scripts/tests/IceBox/admin.py @@ -24,8 +24,8 @@ class IceBoxAdminTestCase(ClientServerTestCase): current.writeln("ok") TestSuite(__name__, [ - ClientServerTestCase(server=IceBox(args=['--Ice.Config="{testdir}/config.icebox{iceboxconfigext}"'])), - IceBoxAdminTestCase("iceboxadmin", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox{iceboxconfigext}"'])), + ClientServerTestCase(server=IceBox("{testdir}/config.icebox")), + IceBoxAdminTestCase("iceboxadmin", server=IceBox("{testdir}/config.icebox")), ], libDirs=["testservice"], runOnMainThread=True, diff --git a/scripts/tests/IceBox/configuration.py b/scripts/tests/IceBox/configuration.py index 02cc5537a92..e895844f3c9 100644 --- a/scripts/tests/IceBox/configuration.py +++ b/scripts/tests/IceBox/configuration.py @@ -9,6 +9,6 @@ # ********************************************************************** TestSuite(__name__, [ - ClientServerTestCase("client/server #1", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox{iceboxconfigext}"'])), - ClientServerTestCase("client/server #2", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox2{iceboxconfigext}"'])) + ClientServerTestCase("client/server #1", server=IceBox("{testdir}/config.icebox")), + ClientServerTestCase("client/server #2", server=IceBox("{testdir}/config.icebox2")) ], libDirs=["testservice"], runOnMainThread=True, options={ "protocol" : ["tcp"], "ipv6" : [False], "mx" : [False] }, multihost=False) |