summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2018-10-18 15:24:08 +0200
committerBenoit Foucher <benoit@zeroc.com>2018-10-18 15:24:08 +0200
commitf0b0d3f3551ec1b4f74c99d77cca1362d8f1c1c2 (patch)
treeb08ce51f7839c7d5c7275dc33baf643e4fc20799
parentFix C# test instructions for .NET Core (diff)
downloadice-f0b0d3f3551ec1b4f74c99d77cca1362d8f1c1c2.tar.bz2
ice-f0b0d3f3551ec1b4f74c99d77cca1362d8f1c1c2.tar.xz
ice-f0b0d3f3551ec1b4f74c99d77cca1362d8f1c1c2.zip
Added support for --cpp-path to test driver
-rw-r--r--cpp/test/IceGrid/distribution/test.py2
-rw-r--r--cpp/test/Slice/errorDetection/test.py2
-rw-r--r--python/test/Slice/import/test.py2
-rw-r--r--scripts/IceGridUtil.py2
-rw-r--r--scripts/Util.py37
-rw-r--r--scripts/tests/IceSSL/configuration.py13
-rw-r--r--scripts/tests/Slice/generation.py4
7 files changed, 37 insertions, 25 deletions
diff --git a/cpp/test/IceGrid/distribution/test.py b/cpp/test/IceGrid/distribution/test.py
index a8942868cd0..490274682ac 100644
--- a/cpp/test/IceGrid/distribution/test.py
+++ b/cpp/test/IceGrid/distribution/test.py
@@ -13,7 +13,7 @@ class IceGridDistributionTestCase(IceGridTestCase):
def setupClientSide(self, current):
IceGridTestCase.setupClientSide(self, current)
- datadir = os.path.join(self.getPath(), "data")
+ datadir = os.path.join(current.testsuite.getPath(), "data")
files = [
[ "original/rootfile", "rootfile" ],
diff --git a/cpp/test/Slice/errorDetection/test.py b/cpp/test/Slice/errorDetection/test.py
index fd416417eda..3a596eb00ad 100644
--- a/cpp/test/Slice/errorDetection/test.py
+++ b/cpp/test/Slice/errorDetection/test.py
@@ -13,7 +13,7 @@ import glob
class SliceErrorDetectionTestCase(ClientTestCase):
def runClientSide(self, current):
- testdir = self.getPath()
+ testdir = current.testsuite.getPath()
slice2cpp = SliceTranslator("slice2cpp")
files = glob.glob("{0}/*.ice".format(testdir))
diff --git a/python/test/Slice/import/test.py b/python/test/Slice/import/test.py
index 9d8d11735f1..f1bfe2cdd3f 100644
--- a/python/test/Slice/import/test.py
+++ b/python/test/Slice/import/test.py
@@ -11,7 +11,7 @@ class SliceImportTestCase(ClientTestCase):
def setupClientSide(self, current):
- testdir = current.testcase.getPath()
+ testdir = current.testsuite.getPath()
if os.path.exists(os.path.join(testdir, "Test1_ice.py")):
os.remove(os.path.join(testdir, "Test1_ice.py"))
if os.path.exists(os.path.join(testdir, "Test2_ice.py")):
diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py
index 698519c45e4..0c2ad2f838c 100644
--- a/scripts/IceGridUtil.py
+++ b/scripts/IceGridUtil.py
@@ -231,7 +231,7 @@ class IceGridTestCase(TestCase):
javaHome = os.environ.get("JAVA_HOME", None)
serverProps = Server().getProps(current)
variables = {
- "test.dir" : self.getPath(),
+ "test.dir" : self.getPath(current),
"java.exe" : os.path.join(javaHome, "bin", "java") if javaHome else "java",
"icebox.exe" : IceBox().getCommandLine(current),
"icegridnode.exe" : IceGridNode().getCommandLine(current),
diff --git a/scripts/Util.py b/scripts/Util.py
index 64eda187962..3013543632f 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -405,7 +405,7 @@ class Windows(Platform):
def getBuildSubDir(self, mapping, name, current):
buildPlatform = current.driver.configs[mapping].buildPlatform
buildConfig = current.driver.configs[mapping].buildConfig
- if os.path.exists(os.path.join(current.testcase.getPath(), "msbuild", name)):
+ if os.path.exists(os.path.join(current.testcase.getPath(current), "msbuild", name)):
return os.path.join("msbuild", name, buildPlatform, buildConfig)
else:
return os.path.join("msbuild", buildPlatform, buildConfig)
@@ -527,6 +527,7 @@ class Mapping(object):
else:
self.buildPlatform = platform.getDefaultBuildPlatform()
+ self.pathOverride = ""
self.protocol = "tcp"
self.compress = False
self.serialize = False
@@ -882,7 +883,7 @@ class Mapping(object):
return os.path.join(self.path, "..", "scripts", "tests")
def getTestCwd(self, process, current):
- return current.testcase.getPath()
+ return current.testcase.getPath(current)
def getDefaultSource(self, processType):
defaultSource = component.getDefaultSource(self, processType)
@@ -935,7 +936,7 @@ class Mapping(object):
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)
+ cmd = os.path.join(current.testcase.getPath(current), current.getBuildDir(exe), exe)
else:
cmd = exe
@@ -1449,8 +1450,12 @@ class TestCase(Runnable):
def getName(self):
return self.name
- def getPath(self):
- return self.testsuite.getPath()
+ def getPath(self, current):
+ path = self.testsuite.getPath()
+ if current.config.pathOverride:
+ return path.replace(toplevel, current.config.pathOverride)
+ else:
+ return path
def getMapping(self):
return self.mapping
@@ -2924,12 +2929,13 @@ class CppMapping(Mapping):
@classmethod
def getSupportedArgs(self):
- return ("", ["cpp-config=", "cpp-platform=", "uwp", "openssl"])
+ return ("", ["cpp-config=", "cpp-platform=", "cpp-path=", "uwp", "openssl"])
@classmethod
def usage(self):
print("")
print("C++ Mapping options:")
+ print("--cpp-path=<path> Path of alternate source tree for the C++ mapping.")
print("--cpp-config=<config> C++ build configuration for native executables (overrides --config).")
print("--cpp-platform=<platform> C++ build platform for native executables (overrides --platform).")
print("--uwp Run UWP (Universal Windows Platform).")
@@ -2942,7 +2948,12 @@ class CppMapping(Mapping):
# tests on the cpp11 value in the testcase options specification
self.cpp11 = self.buildConfig.lower().find("cpp11") >= 0
- parseOptions(self, options, { "cpp-config" : "buildConfig", "cpp-platform" : "buildPlatform" })
+ parseOptions(self, options, { "cpp-config" : "buildConfig",
+ "cpp-platform" : "buildPlatform",
+ "cpp-path" : "pathOverride" })
+
+ if self.pathOverride:
+ self.pathOverride = os.path.abspath(self.pathOverride)
def getOptions(self, current):
return { "compress" : [False] } if current.config.uwp else {}
@@ -3051,8 +3062,8 @@ class JavaMapping(Mapping):
if process.isFromBinDir():
return "{0} -ea {1} {2}".format(java, exe, args)
- assert(current.testcase.getPath().startswith(self.getTestsPath()))
- package = "test." + current.testcase.getPath()[len(self.getTestsPath()) + 1:].replace(os.sep, ".")
+ assert(current.testcase.getPath(current).startswith(self.getTestsPath()))
+ package = "test." + current.testcase.getPath(current)[len(self.getTestsPath()) + 1:].replace(os.sep, ".")
javaArgs = self.getJavaArgs(process, current)
if javaArgs:
return "{0} -ea {1} -Dtest.class={2}.{3} test.TestDriver {4}".format(java, " ".join(javaArgs), package, exe, args)
@@ -3238,7 +3249,7 @@ class CSharpMapping(Mapping):
#
proccessType = current.testcase.getProcessType(process)
if proccessType:
- testdir = os.path.join(current.testcase.getPath(), self.getBuildDir(proccessType, current))
+ testdir = os.path.join(current.testcase.getPath(current), self.getBuildDir(proccessType, current))
if os.path.isfile(os.path.join(testdir, plugin + ".dll")):
plugindir = testdir
@@ -3276,7 +3287,7 @@ class CSharpMapping(Mapping):
if process.isFromBinDir():
path = component.getBinDir(process, self, current)
else:
- path = os.path.join(current.testcase.getPath(), current.getBuildDir(exe))
+ path = os.path.join(current.testcase.getPath(current), current.getBuildDir(exe))
if current.config.dotnetcore:
return "dotnet " + os.path.join(path, exe) + ".dll " + args
@@ -3496,7 +3507,7 @@ class PythonMapping(CppBasedMapping):
# If not installed in the default platform installation directory, add
# the Ice python directory to PYTHONPATH
dirs += self.getPythonDirs(component.getInstallDir(self, current), current.config)
- dirs += [current.testcase.getPath()]
+ dirs += [current.testcase.getPath(current)]
env["PYTHONPATH"] = os.pathsep.join(dirs)
return env
@@ -3546,7 +3557,7 @@ class RubyMapping(CppBasedClientMapping):
# If not installed in the default platform installation directory, add
# the Ice ruby directory to RUBYLIB
dirs += [os.path.join(self.path, "ruby")]
- dirs += [current.testcase.getPath()]
+ dirs += [current.testcase.getPath(current)]
env["RUBYLIB"] = os.pathsep.join(dirs)
return env
diff --git a/scripts/tests/IceSSL/configuration.py b/scripts/tests/IceSSL/configuration.py
index 6203f56871d..2c2c75a15fb 100644
--- a/scripts/tests/IceSSL/configuration.py
+++ b/scripts/tests/IceSSL/configuration.py
@@ -17,7 +17,7 @@ class ConfigurationTestCase(ClientServerTestCase):
if not isinstance(self.getMapping(), CppMapping):
return
- certsPath = os.path.abspath(os.path.join(self.getPath(), "..", "certs"))
+ certsPath = os.path.abspath(os.path.join(current.testsuite.getPath(), "..", "certs"))
if isinstance(platform, Darwin) and current.config.buildPlatform == "macosx":
keychainPath = os.path.join(certsPath, "Find.keychain")
os.system("mkdir -p {0}".format(os.path.join(certsPath, "keychain")))
@@ -40,7 +40,7 @@ class ConfigurationTestCase(ClientServerTestCase):
if not isinstance(self.getMapping(), CppMapping):
return
- certsPath = os.path.abspath(os.path.join(self.getPath(), "..", "certs"))
+ certsPath = os.path.abspath(os.path.join(current.testsuite.getPath(), "..", "certs"))
if isinstance(platform, Darwin) and current.config.buildPlatform == "macosx":
os.system("rm -rf {0} {1}".format(os.path.join(certsPath, "keychain"), os.path.join(certsPath, "Find.keychain")))
elif current.config.openssl or platform.hasOpenSSL():
@@ -49,17 +49,18 @@ class ConfigurationTestCase(ClientServerTestCase):
out = run("{openssl} x509 -subject_hash -noout -in {pem}".format(pem=pem, openssl=self.getOpenSSLCommand()))
os.remove("{dir}/{out}.0".format(out=out, dir=certsPath))
if isinstance(platform, Windows):
- os.remove(os.path.join(self.getPath(), "openssl.cnf"))
+ os.remove(os.path.join(current.testsuite.getPath(), "openssl.cnf"))
del os.environ["OPENSSL_CONF"]
def getOpenSSLCommand(self):
if isinstance(platform, Windows):
- conf = os.path.join(self.getPath(), "openssl.cnf")
+ conf = os.path.join(current.testsuite.getPath(), "openssl.cnf")
os.environ["OPENSSL_CONF"] = conf
with open(conf, "w") as file:
file.write("# Dummy openssl configuration file to avoid warnings with Windows testing")
- return os.path.join(self.getPath(), "..", "..", "..", "msbuild", "packages", "zeroc.openssl.v140.1.0.2.5",
- "build", "native", "bin", "Win32", "Release", "openssl.exe")
+ return os.path.join(current.testsuite.getPath(), "..", "..", "..", "msbuild", "packages",
+ "zeroc.openssl.v140.1.0.2.5", "build", "native", "bin", "Win32", "Release",
+ "openssl.exe")
else:
return "openssl"
diff --git a/scripts/tests/Slice/generation.py b/scripts/tests/Slice/generation.py
index 5d12e905fbc..b4c0929c346 100644
--- a/scripts/tests/Slice/generation.py
+++ b/scripts/tests/Slice/generation.py
@@ -17,10 +17,10 @@ class SliceGenerationTestCase(ClientTestCase):
slice2java.run(current,
args=["--list-generated", "--output-dir", "classes", "File1.ice", "File2.ice"] +
- (["--compat"] if current.testcase.getPath().find("java-compat") >= 0 else []))
+ (["--compat"] if current.testsuite.getPath().find("java-compat") >= 0 else []))
lines1 = slice2java.getOutput(current).strip().split("\n")
- lines2 = open(os.path.join(self.getPath(), "list-generated.out"), "r").readlines()
+ lines2 = open(os.path.join(current.testsuite.getPath(), "list-generated.out"), "r").readlines()
if len(lines1) != len(lines2):
raise RuntimeError("failed!")