bug 525370 - figure out windows bustage with hang detection and re-enable it. r=jwalden

--HG--
extra : rebase_source : 24ea6c09d89f20c21dc7f0b49b6dc62e32cd5934
This commit is contained in:
Ted Mielczarek 2009-10-30 13:00:19 -04:00
Родитель 8b6f59e205
Коммит 2b676dceab
3 изменённых файлов: 18 добавлений и 21 удалений

Просмотреть файл

@ -454,11 +454,6 @@ def environment(env = None, xrePath = DIST_BIN, crashreporter = True):
return env return env
if IS_WIN32: if IS_WIN32:
#XXX: disabled on windows for now, see bug 525370
def readWithTimeout(f, timeout):
return (f.readline(), False)
elif False:
#XXX: figure out what's going wrong with this code!
import ctypes, time, msvcrt import ctypes, time, msvcrt
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
GetLastError = ctypes.windll.kernel32.GetLastError GetLastError = ctypes.windll.kernel32.GetLastError
@ -469,18 +464,24 @@ elif False:
is received within |timeout| seconds, return a blank line. is received within |timeout| seconds, return a blank line.
Returns a tuple (line, did_timeout), where |did_timeout| is True Returns a tuple (line, did_timeout), where |did_timeout| is True
if the read timed out, and False otherwise.""" if the read timed out, and False otherwise."""
if timeout is None:
# shortcut to allow callers to pass in "None" for no timeout.
return (f.readline(), False)
x = msvcrt.get_osfhandle(f.fileno()) x = msvcrt.get_osfhandle(f.fileno())
l = ctypes.c_long() l = ctypes.c_long()
buf = ctypes.create_string_buffer('', 1024)
done = time.time() + timeout done = time.time() + timeout
while time.time() < done: while time.time() < done:
if PeekNamedPipe(x, buf, len(buf), None, ctypes.byref(l), None) == 0: if PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
err = GetLastError() err = GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ('', False) return ('', False)
if (l > 0 and '\n' in buf.value): else:
return (f.readline(), False) log.error("readWithTimeout got error: %d", err)
time.sleep(0.1) if l > 0:
# we're assuming that the output is line-buffered,
# which is not unreasonable
return (f.readline(), False)
time.sleep(0.01)
return ('', True) return ('', True)
else: else:
def readWithTimeout(f, timeout): def readWithTimeout(f, timeout):
@ -506,7 +507,7 @@ def triggerBreakpad(proc, utilityPath):
crashinject = os.path.normpath(os.path.join(utilityPath, "crashinject.exe")) crashinject = os.path.normpath(os.path.join(utilityPath, "crashinject.exe"))
if os.path.exists(crashinject) and subprocess.Popen([crashinject, str(proc.pid)]).wait() == 0: if os.path.exists(crashinject) and subprocess.Popen([crashinject, str(proc.pid)]).wait() == 0:
return return
#TODO: kill the process such that it triggers Breakpad on OS X #TODO: kill the process such that it triggers Breakpad on OS X (bug 525296)
log.info("Can't trigger Breakpad, just killing process") log.info("Can't trigger Breakpad, just killing process")
proc.kill() proc.kill()

Просмотреть файл

@ -70,9 +70,6 @@ if __name__ == '__main__':
appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP) appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, {}, status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, {},
# the profiling HTML doesn't output anything, # the profiling HTML doesn't output anything,
# so let's just set this really high for now. # so let's just run this without a timeout
#FIXME: the POSIX codepath accepts None timeout = None)
# as "no timeout", the Windows codepath
# should too.
timeout = 1800.0)
sys.exit(status) sys.exit(status)

Просмотреть файл

@ -454,8 +454,7 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
if options.timeout: if options.timeout:
timeout = options.timeout + 30 timeout = options.timeout + 30
elif options.autorun: elif options.autorun:
#FIXME: need to support None for timeout values on Win32 timeout = None
timeout = 1000000
else: else:
timeout = 330.0 # default JS harness timeout is 300 seconds timeout = 330.0 # default JS harness timeout is 300 seconds
automation.log.info("INFO | runtests.py | Running tests: start.\n") automation.log.info("INFO | runtests.py | Running tests: start.\n")