summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/test/IceGrid/distribution/test.py2
-rw-r--r--cpp/test/IceGrid/noRestartUpdate/test.py4
-rw-r--r--cpp/test/IceGrid/session/test.py2
-rw-r--r--cpp/test/IceGrid/update/test.py4
-rw-r--r--cpp/test/Slice/unicodePaths/test.py10
-rw-r--r--php/test/Ice/ini/test.py2
-rw-r--r--scripts/Glacier2Util.py2
-rw-r--r--scripts/LocalDriver.py2
-rw-r--r--scripts/Util.py53
-rw-r--r--scripts/tests/Ice/properties.py14
-rw-r--r--scripts/tests/Slice/generation.py2
11 files changed, 46 insertions, 51 deletions
diff --git a/cpp/test/IceGrid/distribution/test.py b/cpp/test/IceGrid/distribution/test.py
index 1c7d8313781..19fc6988644 100644
--- a/cpp/test/IceGrid/distribution/test.py
+++ b/cpp/test/IceGrid/distribution/test.py
@@ -27,7 +27,7 @@ class IceGridDistributionTestCase(IceGridTestCase):
]
current.write("creating IcePatch2 data directory... ")
- self.mkdirs(datadir)
+ current.mkdirs(datadir)
for [file, content] in files:
file = os.path.join(datadir, file)
diff --git a/cpp/test/IceGrid/noRestartUpdate/test.py b/cpp/test/IceGrid/noRestartUpdate/test.py
index e4b1fdbd0d8..3e2d6ae42b3 100644
--- a/cpp/test/IceGrid/noRestartUpdate/test.py
+++ b/cpp/test/IceGrid/noRestartUpdate/test.py
@@ -12,8 +12,8 @@ class IceGridNoRestartUpdateTestCase(IceGridTestCase):
def setupClientSide(self, current):
IceGridTestCase.setupClientSide(self, current)
- self.mkdirs("db/node1")
- self.mkdirs("db/node2")
+ current.mkdirs("db/node1")
+ current.mkdirs("db/node2")
clientProps = lambda process, current: {
"IceBoxExe" : IceBox().getCommandLine(current),
diff --git a/cpp/test/IceGrid/session/test.py b/cpp/test/IceGrid/session/test.py
index e119aab24eb..53ce45a63cb 100644
--- a/cpp/test/IceGrid/session/test.py
+++ b/cpp/test/IceGrid/session/test.py
@@ -12,7 +12,7 @@ class IceGridSessionTestCase(IceGridTestCase):
def setupClientSide(self, current):
IceGridTestCase.setupClientSide(self, current)
- self.mkdirs("db/node-1")
+ current.mkdirs("db/node-1")
def setupServerSide(self, current):
self.verifier = Server(exe="verifier", waitForShutdown=False, props={
diff --git a/cpp/test/IceGrid/update/test.py b/cpp/test/IceGrid/update/test.py
index 8ac439aefaf..75b1c206b44 100644
--- a/cpp/test/IceGrid/update/test.py
+++ b/cpp/test/IceGrid/update/test.py
@@ -12,8 +12,8 @@ class IceGridUpdateTestCase(IceGridTestCase):
def setupClientSide(self, current):
IceGridTestCase.setupClientSide(self, current)
- self.mkdirs("db/node-1")
- self.mkdirs("db/node-2")
+ current.mkdirs("db/node-1")
+ current.mkdirs("db/node-2")
clientProps = lambda process, current: {
"NodePropertiesOverride" : current.testcase.icegridnode[0].getPropertiesOverride(current),
diff --git a/cpp/test/Slice/unicodePaths/test.py b/cpp/test/Slice/unicodePaths/test.py
index 95923fc10c2..ad07f3b9855 100644
--- a/cpp/test/Slice/unicodePaths/test.py
+++ b/cpp/test/Slice/unicodePaths/test.py
@@ -33,11 +33,11 @@ class SliceUnicodePathsTestCase(ClientTestCase):
if os.path.exists(srcPath): shutil.rmtree(srcPath)
os.mkdir(srcPath)
- self.createFile("%s/Test.ice" % srcPath,
- ["module Test { ",
- "class Point{int x; int y; };",
- "interface Canvas{ void draw(Point p); };",
- "};"], "utf-8")
+ current.createFile("%s/Test.ice" % srcPath,
+ ["module Test { ",
+ "class Point{int x; int y; };",
+ "interface Canvas{ void draw(Point p); };",
+ "};"], "utf-8")
tests = [
("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++11"),
diff --git a/php/test/Ice/ini/test.py b/php/test/Ice/ini/test.py
index 05be95fe1aa..f2c6e810dc9 100644
--- a/php/test/Ice/ini/test.py
+++ b/php/test/Ice/ini/test.py
@@ -16,7 +16,7 @@ class IniClient(Client):
def setup(self, current):
if self.iceProfile:
- current.testcase.createFile("ice.profiles", [
+ current.createFile("ice.profiles", [
"[%s]" % self.iceProfile,
"ice.config=\"config.client\"",
"ice.options=\"%s\"" % self.iceOptions,
diff --git a/scripts/Glacier2Util.py b/scripts/Glacier2Util.py
index 77977af4e79..65011a52a61 100644
--- a/scripts/Glacier2Util.py
+++ b/scripts/Glacier2Util.py
@@ -43,7 +43,7 @@ class Glacier2Router(ProcessFromBinDir, Server):
if(p.wait() != 0):
raise RuntimeError("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip())
file.write("%s %s\n" % (user, p.stdout.readline().decode('UTF-8').strip()))
- current.testcase.files.append(path)
+ current.files.append(path)
def getProps(self, current):
props = Server.getProps(self, current)
diff --git a/scripts/LocalDriver.py b/scripts/LocalDriver.py
index b3d59be6d7e..3219529b406 100644
--- a/scripts/LocalDriver.py
+++ b/scripts/LocalDriver.py
@@ -58,6 +58,8 @@ class Executor:
raise
except:
pass
+ finally:
+ current.destroy()
results.put((result, mainThread))
if not result.isSuccess() and not self.continueOnFailure:
with self.lock: self.failure = True
diff --git a/scripts/Util.py b/scripts/Util.py
index 25b9ea9c890..50ea22bf83f 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -1207,8 +1207,6 @@ class TestCase(Runnable):
self.mapping = None
self.testsuite = None
self.options = options
- self.dirs = []
- self.files = []
self.args = args
self.props = props
self.envs = envs
@@ -1417,24 +1415,6 @@ class TestCase(Runnable):
raise
finally:
current.pop()
- for d in self.dirs:
- if os.path.exists(d): shutil.rmtree(d)
- for f in self.files:
- if os.path.exists(f): os.unlink(f)
-
- def createFile(self, path, lines, encoding=None):
- path = os.path.join(self.getPath(), path.decode("utf-8") if isPython2 else path)
- with open(path, "w", encoding=encoding) if not isPython2 and encoding else open(path, "w") as file:
- for l in lines:
- file.write("%s\n" % l)
- self.files.append(path)
-
- def mkdirs(self, dirs):
- for d in dirs if isinstance(dirs, list) else [dirs]:
- d = os.path.join(self.getPath(), d)
- self.dirs.append(d)
- if not os.path.exists(d):
- os.makedirs(d)
class ClientTestCase(TestCase):
@@ -1573,7 +1553,7 @@ class TestSuite:
if self.chdir:
# Only tests running on main thread can change the current working directory
self.runOnMainThread = True
- self.files = []
+
if testcases is None:
files = [f for f in os.listdir(self.path) if os.path.isfile(os.path.join(self.path, f))]
testcases = self.mapping.computeTestCases(self.id, files)
@@ -1633,19 +1613,10 @@ class TestSuite:
current.driver.runTestSuite(current)
finally:
if cwd: os.chdir(cwd)
- for f in self.files:
- if os.path.exists(f): os.remove(f)
def teardown(self, current, success):
pass
- def createFile(self, path, lines, encoding=None):
- path = os.path.join(self.path, path.decode("utf-8") if isPython2 else path)
- with open(path, "w", encoding=encoding) if not isPython2 and encoding else open(path, "w") as file:
- for l in lines:
- file.write("%s\n" % l)
- self.files.append(path)
-
def isMultiHost(self):
return self.multihost
@@ -2150,6 +2121,8 @@ class Driver:
self.testcase = None
self.testcases = []
self.processes = {}
+ self.dirs = []
+ self.files = []
def getTestEndpoint(self, *args, **kargs):
return self.driver.getTestEndpoint(*args, **kargs)
@@ -2186,6 +2159,26 @@ class Driver:
testcase.testsuite = None
testcase.parent = None
+ def createFile(self, path, lines, encoding=None):
+ path = os.path.join(self.testsuite.getPath(), path.decode("utf-8") if isPython2 else path)
+ with open(path, "w", encoding=encoding) if not isPython2 and encoding else open(path, "w") as file:
+ for l in lines:
+ file.write("%s\n" % l)
+ self.files.append(path)
+
+ def mkdirs(self, dirs):
+ for d in dirs if isinstance(dirs, list) else [dirs]:
+ d = os.path.join(self.testsuite.getPath(), d)
+ self.dirs.append(d)
+ if not os.path.exists(d):
+ os.makedirs(d)
+
+ def destroy(self):
+ for d in self.dirs:
+ if os.path.exists(d): shutil.rmtree(d)
+ for f in self.files:
+ if os.path.exists(f): os.unlink(f)
+
drivers = {}
driver = "local"
diff --git a/scripts/tests/Ice/properties.py b/scripts/tests/Ice/properties.py
index f0a862ad735..d70d2c1b303 100644
--- a/scripts/tests/Ice/properties.py
+++ b/scripts/tests/Ice/properties.py
@@ -12,12 +12,12 @@ class PropertiesTestSuite(TestSuite):
def setup(self, current):
name = "\xe4\xb8\xad\xe5\x9b\xbd_client.config" if isPython2 else "\u4e2d\u56fd_client.config"
- self.createFile("./config/" + name,
- ["# Automatically generated by Ice test driver.",
- "Ice.Trace.Protocol=1",
- "Ice.Trace.Network=1",
- "Ice.ProgramName=PropertiesClient",
- "Config.Path=./config/" + name],
- "utf-8")
+ current.createFile("./config/" + name,
+ ["# Automatically generated by Ice test driver.",
+ "Ice.Trace.Protocol=1",
+ "Ice.Trace.Network=1",
+ "Ice.ProgramName=PropertiesClient",
+ "Config.Path=./config/" + name],
+ "utf-8")
PropertiesTestSuite(__name__, [ ClientTestCase(client=Client(args=["{testdir}"])) ])
diff --git a/scripts/tests/Slice/generation.py b/scripts/tests/Slice/generation.py
index c6752e76eb1..ddd4c949110 100644
--- a/scripts/tests/Slice/generation.py
+++ b/scripts/tests/Slice/generation.py
@@ -4,7 +4,7 @@ class SliceGenerationTestCase(ClientTestCase):
current.write("testing list-generated... ")
slice2java = SliceTranslator("slice2java")
- self.mkdirs("classes")
+ current.mkdirs("classes")
slice2java.run(current,
args=["--list-generated", "--output-dir", "classes", "File1.ice", "File2.ice"] +