summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2014-12-05 09:52:34 -0500
committerJoe George <joe@zeroc.com>2014-12-05 09:53:16 -0500
commit5be8ba3352d49b3d3d4b98362d3f89538688bc2f (patch)
tree97eb8d9f297e0c34bece637d02ebf0ee12c4eb1c
parentAdditional fix for ICE-6050, Ice/hold JS failure (diff)
downloadice-5be8ba3352d49b3d3d4b98362d3f89538688bc2f.tar.bz2
ice-5be8ba3352d49b3d3d4b98362d3f89538688bc2f.tar.xz
ice-5be8ba3352d49b3d3d4b98362d3f89538688bc2f.zip
ICE-6005 - Fix TestUtil hanging while trying to shutdown
-rwxr-xr-xscripts/Expect.py32
-rwxr-xr-xscripts/TestUtil.py4
2 files changed, 17 insertions, 19 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py
index 53ab939f7bb..a89283aa96d 100755
--- a/scripts/Expect.py
+++ b/scripts/Expect.py
@@ -7,16 +7,17 @@
#
# **********************************************************************
-import threading
-import subprocess
-import string
-import time
-import re
-import traceback
-import sys
+import atexit
import os
+import re
import signal
+import string
+import subprocess
+import sys
import sys
+import threading
+import time
+import traceback
__all__ = ["Expect", "EOF", "TIMEOUT" ]
@@ -327,6 +328,9 @@ def cleanup():
processes[k].terminate()
except:
pass
+ processes.clear()
+
+atexit.register(cleanup)
class Expect (object):
def __init__(self, command, startReader = True, timeout=30, logfile=None, mapping = None, desc = None, cwd = None, env = None):
@@ -373,8 +377,7 @@ class Expect (object):
# The thread is marked as a daemon thread. This is done so that if
# an expect script runs off the end of main without kill/wait on each
# spawned process the script will not hang tring to join with the
- # reader thread. Instead __del__ (below) will be called which
- # terminates and joins with the reader thread.
+ # reader thread.
self.r.setDaemon(True)
if startReader:
@@ -385,13 +388,6 @@ class Expect (object):
self.r.setWatchDog(watchDog)
self.r.start()
- def __del__(self):
- # Terminate and clean up.
- if self.p is not None:
- global processes
- del processes[self.p.pid]
- self.terminate()
-
def expect(self, pattern, timeout = 20):
"""pattern is either a string, or a list of string regexp patterns.
@@ -485,6 +481,8 @@ class Expect (object):
# A Windows application killed with CTRL_BREAK. Fudge the exit status.
if win32 and self.exitstatus != 0 and self.killed is not None:
self.exitstatus = -self.killed
+ global processes
+ del processes[self.p.pid]
self.p = None
self.r.join()
# Simulate a match on EOF
@@ -594,8 +592,8 @@ class Expect (object):
test(self.exitstatus, exitstatus)
else:
test(self.exitstatus, exitstatus)
+
except:
- print("cleanup")
cleanup()
raise
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 5665dc9c066..ee54840a045 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -1198,7 +1198,7 @@ def isDebug():
return open(os.path.join(os.getcwd(), "build.txt"), "r").read().strip() == "debug"
#
# Try to guess, if icebox release executable exists in the C++ bin dir
- # we assume is a release build or bin dist, tests that depends on debug
+ # we assume is a release build or bin dist, tests that depends on debug
# or release (C++) need to create the build.txt file.
#
exe = "icebox"
@@ -1735,7 +1735,7 @@ def getJavaLibraryPath():
if iceHome:
return "-Djava.library.path=%s " % os.path.join(iceHome, "lib")
elif thirdPartyHome:
- return "-Djava.library.path=%s " % os.path.join(thirdPartyHome, "lib")
+ return "-Djava.library.path=%s " % os.path.join(thirdPartyHome, "lib")
elif isRhel() or isSles():
return "-Djava.library.path=%s " % ("/usr/lib64" if x64 else "/usr/lib")
elif isUbuntu():