diff --git a/mozilla/testing/performance/talos/bcontroller.py b/mozilla/testing/performance/talos/bcontroller.py index 6f107f27433..5bbee5e3f6d 100644 --- a/mozilla/testing/performance/talos/bcontroller.py +++ b/mozilla/testing/performance/talos/bcontroller.py @@ -90,10 +90,11 @@ class BrowserWaiter(threading.Thread): class BrowserController: - def __init__(self, command, mod, name, timeout, log): + def __init__(self, command, mod, name, child_process, timeout, log): self.command = command self.mod = mod self.process_name = name + self.child_process = child_process self.browser_wait = timeout self.log = log self.timeout = 600 #no output from the browser in 10 minutes = failure @@ -105,7 +106,7 @@ class BrowserController: while not self.bwaiter.hasTime(): if noise > self.timeout: # check for frozen browser try: - ffprocess.cleanupProcesses(self.process_name, self.browser_wait) + ffprocess.cleanupProcesses(self.process_name, self.child_process, self.browser_wait) except talosError, te: os.abort() #kill myself off because something horrible has happened os.chmod(self.log, 0777) @@ -135,13 +136,14 @@ def main(argv=None): command = "" name = "firefox" #default + child_process = "mozilla-runtime" #default timeout = "" log = "" mod = "" if argv is None: argv = sys.argv - opts, args = getopt.getopt(argv[1:], "c:t:n:l:m:", ["command=", "timeout=", "name=", "log=", "mod="]) + opts, args = getopt.getopt(argv[1:], "c:t:n:p:l:m:", ["command=", "timeout=", "name=", "child_process=", "log=", "mod="]) # option processing for option, value in opts: @@ -151,13 +153,15 @@ def main(argv=None): timeout = int(value) if option in ("-n", "--name"): name = value + if option in ("-p", "--child_process"): + child_process = value if option in ("-l", "--log"): log = value if option in ("-m", "--mod"): mod = value if command and timeout and log: - bcontroller = BrowserController(command, mod, name, timeout, log) + bcontroller = BrowserController(command, mod, name, child_process, timeout, log) bcontroller.run() else: print "\nFAIL: no command\n" diff --git a/mozilla/testing/performance/talos/ffprocess.py b/mozilla/testing/performance/talos/ffprocess.py index 7fb6956b024..bb54b054735 100755 --- a/mozilla/testing/performance/talos/ffprocess.py +++ b/mozilla/testing/performance/talos/ffprocess.py @@ -112,18 +112,18 @@ def checkBrowserAlive(process_name): #is the browser actually up? return (ProcessesWithNameExist(process_name) and not ProcessesWithNameExist("crashreporter", "talkback", "dwwin")) -def checkAllProcesses(process_name): +def checkAllProcesses(process_name, child_process): #is anything browser related active? - return ProcessesWithNameExist(process_name, "crashreporter", "talkback", "dwwin") + return ProcessesWithNameExist(process_name, child_process, "crashreporter", "talkback", "dwwin") -def cleanupProcesses(process_name, browser_wait): +def cleanupProcesses(process_name, child_process, browser_wait): #kill any remaining browser processes - TerminateAllProcesses(browser_wait, process_name, "crashreporter", "dwwin", "talkback") + TerminateAllProcesses(browser_wait, process_name, child_process, "crashreporter", "dwwin", "talkback") #check if anything is left behind - if checkAllProcesses(process_name): + if checkAllProcesses(process_name, child_process): #this is for windows machines. when attempting to send kill messages to win processes the OS # always gives the process a chance to close cleanly before terminating it, this takes longer # and we need to give it a little extra time to complete time.sleep(browser_wait) - if checkAllProcesses(process_name): + if checkAllProcesses(process_name, child_process): raise talosError("failed to cleanup") diff --git a/mozilla/testing/performance/talos/run_tests.py b/mozilla/testing/performance/talos/run_tests.py index 92fc3cae201..920be7f55fe 100755 --- a/mozilla/testing/performance/talos/run_tests.py +++ b/mozilla/testing/performance/talos/run_tests.py @@ -352,6 +352,10 @@ def test_file(filename): 'env' : yaml_config['env'], 'dirs' : yaml_config['dirs'], 'init_url' : yaml_config['init_url']} + if 'child_process' in yaml_config: + browser_config['child_process'] = yaml_config['child_process'] + else: + browser_config['child_process'] = 'mozilla-runtime' if 'branch_name' in yaml_config: browser_config['branch_name'] = yaml_config['branch_name'] if 'test_name_extension' in yaml_config: diff --git a/mozilla/testing/performance/talos/ttest.py b/mozilla/testing/performance/talos/ttest.py index d6f0138a6c1..a5200691819 100644 --- a/mozilla/testing/performance/talos/ttest.py +++ b/mozilla/testing/performance/talos/ttest.py @@ -96,7 +96,7 @@ def initializeProfile(profile_dir, browser_config): if not (ffsetup.InitializeNewProfile(browser_config['browser_path'], browser_config['process'], browser_config['browser_wait'], browser_config['extra_args'], profile_dir, browser_config['init_url'], browser_config['browser_log'])): raise talosError("failed to initialize browser") time.sleep(browser_config['browser_wait']) - if ffprocess.checkAllProcesses(browser_config['process']): + if ffprocess.checkAllProcesses(browser_config['process'], browser_config['child_process']): raise talosError("browser failed to close after being initialized") def cleanupProfile(dir): @@ -162,7 +162,7 @@ def runTest(browser_config, test_config): profile_dir = None try: - if ffprocess.checkAllProcesses(browser_config['process']): + if ffprocess.checkAllProcesses(browser_config['process'], browser_config['child_process']): utils.debug(browser_config['process'] + " already running before testing started (unclean system)") raise talosError("system not clean") @@ -188,7 +188,7 @@ def runTest(browser_config, test_config): os.remove(browser_config['browser_log']) time.sleep(browser_config['browser_wait']) #wait out the browser closing # check to see if the previous cycle is still hanging around - if (i > 0) and ffprocess.checkAllProcesses(browser_config['process']): + if (i > 0) and ffprocess.checkAllProcesses(browser_config['process'], browser_config['child_process']): raise talosError("previous cycle still running") # Execute the test's head script if there is one @@ -212,9 +212,9 @@ def runTest(browser_config, test_config): utils.debug("command line: " + command_line) if 'url_mod' in test_config: - process = subprocess.Popen('python bcontroller.py --command "%s" --mod "%s" --name %s --timeout %d --log %s' % (command_line, test_config['url_mod'], browser_config['process'], browser_config['browser_wait'], browser_config['browser_log']), universal_newlines=True, shell=True, bufsize=0, env=os.environ) + process = subprocess.Popen('python bcontroller.py --command "%s" --mod "%s" --name %s --child_process %s --timeout %d --log %s' % (command_line, test_config['url_mod'], browser_config['process'], browser_config['child_process'], browser_config['browser_wait'], browser_config['browser_log']), universal_newlines=True, shell=True, bufsize=0, env=os.environ) else: - process = subprocess.Popen('python bcontroller.py --command "%s" --name %s --timeout %d --log %s' % (command_line, browser_config['process'], browser_config['browser_wait'], browser_config['browser_log']), universal_newlines=True, shell=True, bufsize=0, env=os.environ) + process = subprocess.Popen('python bcontroller.py --command "%s" --name %s --child_process %s --timeout %d --log %s' % (command_line, browser_config['process'], browser_config['child_process'], browser_config['browser_wait'], browser_config['browser_log']), universal_newlines=True, shell=True, bufsize=0, env=os.environ) #give browser a chance to open # this could mean that we are losing the first couple of data points as the tests starts, but if we don't provide @@ -303,7 +303,7 @@ def runTest(browser_config, test_config): raise talosError("error executing tail script: %s" % sys.exc_info()[0]) - ffprocess.cleanupProcesses(browser_config['process'], browser_config['browser_wait']) + ffprocess.cleanupProcesses(browser_config['process'], browser_config['child_process'], browser_config['browser_wait']) cleanupProfile(temp_dir) utils.restoreEnvironmentVars() @@ -321,7 +321,7 @@ def runTest(browser_config, test_config): results_file.close() utils.noisy(results_raw) - ffprocess.cleanupProcesses(browser_config['process'], browser_config['browser_wait']) + ffprocess.cleanupProcesses(browser_config['process'], browser_config['child_process'], browser_config['browser_wait']) if profile_dir: try: