diff --git a/mozilla/testing/performance/talos/ffprocess_linux.py b/mozilla/testing/performance/talos/ffprocess_linux.py index bf7e8f2bc56..ad847761d4e 100644 --- a/mozilla/testing/performance/talos/ffprocess_linux.py +++ b/mozilla/testing/performance/talos/ffprocess_linux.py @@ -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 diff --git a/mozilla/testing/performance/talos/ffprocess_mac.py b/mozilla/testing/performance/talos/ffprocess_mac.py index c55c3fdd594..aabfd7fc79f 100644 --- a/mozilla/testing/performance/talos/ffprocess_mac.py +++ b/mozilla/testing/performance/talos/ffprocess_mac.py @@ -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) diff --git a/mozilla/testing/performance/talos/ffprofile_unix.py b/mozilla/testing/performance/talos/ffprofile_unix.py index 7ef4e810aff..90bc9c9f081 100644 --- a/mozilla/testing/performance/talos/ffprofile_unix.py +++ b/mozilla/testing/performance/talos/ffprofile_unix.py @@ -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) diff --git a/mozilla/testing/performance/talos/ttest.py b/mozilla/testing/performance/talos/ttest.py index 08eedabc2aa..9a9cc79c51e 100644 --- a/mozilla/testing/performance/talos/ttest.py +++ b/mozilla/testing/performance/talos/ttest.py @@ -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)