Bug 1541215 - [raptor] Make post_startup_delay configurable. r=rwood
authorHenrik Skupin <mail@hskupin.info>
Thu, 04 Apr 2019 06:13:05 +0000
changeset 467922 a77666feb3580c20b3b0f23bed0254cd90be05e4
parent 467921 bf54318fe559218e7ffa139a9ad0cf3c3869bf43
child 467923 3f56360e90add2384b4137b8a092b8c544f8b126
push id112667
push useraiakab@mozilla.com
push dateThu, 04 Apr 2019 16:12:45 +0000
treeherdermozilla-inbound@230bb363f2f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrwood
bugs1541215
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541215 - [raptor] Make post_startup_delay configurable. r=rwood Differential Revision: https://phabricator.services.mozilla.com/D25857
testing/raptor/raptor/cmdline.py
testing/raptor/raptor/raptor.py
--- a/testing/raptor/raptor/cmdline.py
+++ b/testing/raptor/raptor/cmdline.py
@@ -81,16 +81,21 @@ def create_parser(mach_interface=False):
             help="How many samples to take with the profiler")
     add_arg('--symbolsPath', dest='symbols_path',
             help="Path to the symbols for the build we are testing")
     add_arg('--page-cycles', dest="page_cycles", type=int,
             help="How many times to repeat loading the test page (for page load tests); "
                  "for benchmark tests this is how many times the benchmark test will be run")
     add_arg('--page-timeout', dest="page_timeout", type=int,
             help="How long to wait (ms) for one page_cycle to complete, before timing out")
+    add_arg('--post-startup-delay',
+            dest='post_startup_delay',
+            type=int,
+            default=30000,
+            help='How long to wait (ms) after browser start-up before starting the tests')
     add_arg('--browser-cycles', dest="browser_cycles", type=int,
             help="The number of times a cold load test is repeated (for cold load tests only, "
             "where the browser is shutdown and restarted between test iterations)")
     add_arg('--print-tests', action=_PrintTests,
             help="Print all available Raptor tests")
     add_arg('--debug-mode', dest="debug_mode", action="store_true",
             help="Run Raptor in debug mode (open browser console, limited page-cycles, etc.)")
     if not mach_interface:
--- a/testing/raptor/raptor/raptor.py
+++ b/testing/raptor/raptor/raptor.py
@@ -59,17 +59,17 @@ from utils import view_gecko_profile
 
 
 class Raptor(object):
     """Container class for Raptor"""
 
     def __init__(self, app, binary, run_local=False, obj_path=None,
                  gecko_profile=False, gecko_profile_interval=None, gecko_profile_entries=None,
                  symbols_path=None, host=None, power_test=False, is_release_build=False,
-                 debug_mode=False, activity=None):
+                 debug_mode=False, post_startup_delay=None, activity=None):
 
         # Override the magic --host HOST_IP with the value of the environment variable.
         if host == 'HOST_IP':
             host = os.environ['HOST_IP']
         self.config = {}
         self.config['app'] = app
         self.config['binary'] = binary
         self.config['platform'] = mozinfo.os
@@ -85,27 +85,27 @@ class Raptor(object):
         self.config['is_release_build'] = is_release_build
         self.raptor_venv = os.path.join(os.getcwd(), 'raptor-venv')
         self.log = get_default_logger(component='raptor-main')
         self.control_server = None
         self.playback = None
         self.benchmark = None
         self.benchmark_port = 0
         self.gecko_profiler = None
-        self.post_startup_delay = 30000
+        self.post_startup_delay = post_startup_delay
         self.device = None
         self.profile_class = app
         self.firefox_android_apps = ['fennec', 'geckoview', 'refbrow', 'fenix']
 
         # debug mode is currently only supported when running locally
         self.debug_mode = debug_mode if self.config['run_local'] else False
 
         # if running debug-mode reduce the pause after browser startup
         if self.debug_mode:
-            self.post_startup_delay = 3000
+            self.post_startup_delay = min(self.post_startup_delay, 3000)
             self.log.info("debug-mode enabled, reducing post-browser startup pause to %d ms"
                           % self.post_startup_delay)
 
         self.log.info("main raptor init, config is: %s" % str(self.config))
 
         # create results holder
         self.results_handler = RaptorResultsHandler()
 
@@ -372,20 +372,21 @@ class Raptor(object):
             pass
         self.log.info("finished")
 
 
 class RaptorDesktop(Raptor):
     def __init__(self, app, binary, run_local=False, obj_path=None,
                  gecko_profile=False, gecko_profile_interval=None, gecko_profile_entries=None,
                  symbols_path=None, host=None, power_test=False, is_release_build=False,
-                 debug_mode=False, activity=None):
+                 debug_mode=False, post_startup_delay=None, activity=None):
         Raptor.__init__(self, app, binary, run_local, obj_path, gecko_profile,
                         gecko_profile_interval, gecko_profile_entries, symbols_path,
-                        host, power_test, is_release_build, debug_mode)
+                        host, power_test, is_release_build, debug_mode,
+                        post_startup_delay)
 
     def create_browser_handler(self):
         # create the desktop browser runner
         self.log.info("creating browser runner using mozrunner")
         self.output_handler = OutputHandler()
         process_args = {
             'processOutputLine': [self.output_handler],
         }
@@ -438,20 +439,21 @@ class RaptorDesktop(Raptor):
         except NotImplementedError:  # not implemented for Chrome
             pass
 
 
 class RaptorDesktopFirefox(RaptorDesktop):
     def __init__(self, app, binary, run_local=False, obj_path=None,
                  gecko_profile=False, gecko_profile_interval=None, gecko_profile_entries=None,
                  symbols_path=None, host=None, power_test=False, is_release_build=False,
-                 debug_mode=False, activity=None):
+                 debug_mode=False, post_startup_delay=None, activity=None):
         RaptorDesktop.__init__(self, app, binary, run_local, obj_path, gecko_profile,
                                gecko_profile_interval, gecko_profile_entries, symbols_path,
-                               host, power_test, is_release_build, debug_mode)
+                               host, power_test, is_release_build, debug_mode,
+                               post_startup_delay)
 
     def disable_non_local_connections(self):
         # For Firefox we need to set MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 env var before startup
         # when testing release builds from mozilla-beta/release. This is because of restrictions
         # on release builds that require webextensions to be signed unless this env var is set
         self.log.info("setting MOZ_DISABLE_NONLOCAL_CONNECTIONS=1")
         os.environ['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = "1"
 
@@ -482,20 +484,21 @@ class RaptorDesktopFirefox(RaptorDesktop
             # to disk; then profiles are picked up by gecko_profile.symbolicate
             self.control_server.gecko_profile_dir = self.gecko_profiler.gecko_profile_dir
 
 
 class RaptorDesktopChrome(RaptorDesktop):
     def __init__(self, app, binary, run_local=False, obj_path=None,
                  gecko_profile=False, gecko_profile_interval=None, gecko_profile_entries=None,
                  symbols_path=None, host=None, power_test=False, is_release_build=False,
-                 debug_mode=False, activity=None):
+                 debug_mode=False, post_startup_delay=None, activity=None):
         RaptorDesktop.__init__(self, app, binary, run_local, obj_path, gecko_profile,
                                gecko_profile_interval, gecko_profile_entries, symbols_path,
-                               host, power_test, is_release_build, debug_mode)
+                               host, power_test, is_release_build, debug_mode,
+                               post_startup_delay)
 
     def setup_chrome_desktop_for_playback(self):
         # if running a pageload test on google chrome, add the cmd line options
         # to turn on the proxy and ignore security certificate errors
         # if using host localhost, 127.0.0.1.
         chrome_args = [
             '--proxy-server=127.0.0.1:8080',
             '--proxy-bypass-list=localhost;127.0.0.1',
@@ -519,20 +522,20 @@ class RaptorDesktopChrome(RaptorDesktop)
 
         self.start_runner_proc()
 
 
 class RaptorAndroid(Raptor):
     def __init__(self, app, binary, run_local=False, obj_path=None,
                  gecko_profile=False, gecko_profile_interval=None, gecko_profile_entries=None,
                  symbols_path=None, host=None, power_test=False, is_release_build=False,
-                 debug_mode=False, activity=None):
+                 debug_mode=False, post_startup_delay=None, activity=None):
         Raptor.__init__(self, app, binary, run_local, obj_path, gecko_profile,
                         gecko_profile_interval, gecko_profile_entries, symbols_path, host,
-                        power_test, is_release_build, debug_mode)
+                        power_test, is_release_build, debug_mode, post_startup_delay)
 
         # on android, when creating the browser profile, we want to use a 'firefox' type profile
         self.profile_class = "firefox"
         self.config['activity'] = activity
 
     def create_browser_handler(self):
         # create the android device handler; it gets initiated and sets up adb etc
         self.log.info("creating android device handler using mozdevice")
@@ -837,16 +840,17 @@ def main(args=sys.argv[1:]):
                           gecko_profile=args.gecko_profile,
                           gecko_profile_interval=args.gecko_profile_interval,
                           gecko_profile_entries=args.gecko_profile_entries,
                           symbols_path=args.symbols_path,
                           host=args.host,
                           power_test=args.power_test,
                           is_release_build=args.is_release_build,
                           debug_mode=args.debug_mode,
+                          post_startup_delay=args.post_startup_delay,
                           activity=args.activity)
 
     raptor.create_browser_profile()
     raptor.create_browser_handler()
     raptor.start_control_server()
 
     for next_test in raptor_test_list:
         raptor.run_test(next_test, timeout=int(next_test['page_timeout']))