Bug 410041 - qm-mini-ubuntu talos machines sometimes taking ~8 hours for a run
a=anodelman r=rcampbell git-svn-id: svn://10.0.0.236/trunk@242313 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -39,6 +39,7 @@ import subprocess
|
||||
import signal
|
||||
import os
|
||||
from select import select
|
||||
import time
|
||||
|
||||
|
||||
|
||||
@@ -114,10 +115,16 @@ def TerminateProcess(pid):
|
||||
pid: integer process id of the process to terminate.
|
||||
"""
|
||||
try:
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
time.sleep(5)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
time.sleep(5)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
print 'WARNING: failed to terminate: %s' % (str(pid))
|
||||
except OSError, (errno, strerror):
|
||||
print 'WARNING: failed os.kill: %s : %s' % (errno, strerror)
|
||||
|
||||
print 'WARNING: failed os.kill: %s : %s' % (errno, strerror)
|
||||
|
||||
def TerminateAllProcesses(process_name):
|
||||
"""Helper function to terminate all processes with the given process name
|
||||
|
||||
@@ -118,7 +118,14 @@ def TerminateProcess(pid):
|
||||
pid: integer process id of the process to terminate.
|
||||
"""
|
||||
try:
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
time.sleep(5)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
time.sleep(5)
|
||||
if ProcessesWithNameExist(str(pid)):
|
||||
print 'WARNING: failed to terminate: %s' % (str(pid))
|
||||
except OSError, (errno, strerror):
|
||||
print 'WARNING: failed os.kill: %s : %s' % (errno, strerror)
|
||||
|
||||
|
||||
@@ -45,8 +45,13 @@ def MakeDirectoryContentsWritable(dirname):
|
||||
Args:
|
||||
dirname: Name of the directory to make contents writable.
|
||||
"""
|
||||
|
||||
for (root, dirs, files) in os.walk(dirname):
|
||||
os.chmod(root, 0755)
|
||||
for filename in files:
|
||||
os.chmod(os.path.join(root, filename), 0755)
|
||||
try:
|
||||
for (root, dirs, files) in os.walk(dirname):
|
||||
os.chmod(root, 0755)
|
||||
for filename in files:
|
||||
try:
|
||||
os.chmod(os.path.join(root, filename), 0755)
|
||||
except OSError, (errno, strerror):
|
||||
print 'WARNING: failed to os.chmod(%s): %s : %s' % (os.path.join(root, filename), errno, strerror)
|
||||
except OSError, (errno, strerror):
|
||||
print 'WARNING: failed to MakeDirectoryContentsWritable: %s : %s' % (errno, strerror)
|
||||
|
||||
@@ -215,6 +215,7 @@ def runTest(browser_config, test_config):
|
||||
|
||||
utils.debug("Completed test with: " + browser_results)
|
||||
#kill any remaining firefox processes
|
||||
ffprocess.Sleep()
|
||||
ffprocess.TerminateAllProcesses("firefox")
|
||||
all_browser_results.append(browser_results)
|
||||
all_counter_results.append(counter_results)
|
||||
@@ -222,7 +223,6 @@ def runTest(browser_config, test_config):
|
||||
# Delete the temp profile directory Make it writeable first,
|
||||
# because every once in a while Firefox seems to drop a read-only
|
||||
# file into it.
|
||||
ffprocess.Sleep()
|
||||
ffsetup.MakeDirectoryContentsWritable(temp_dir)
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user