Bug 1506928 - [raptor] Refactor arguments for constructors of Raptor classes. r=rwood
authorHenrik Skupin <mail@hskupin.info>
Wed, 24 Apr 2019 19:06:13 +0000
changeset 470741 97795bbf4e35329511b1371da8f5a7c0c8a7d87a
parent 470740 ec3fe3df0985e35f654dbf5854a19fce8b79fe44
child 470742 dbd92ad84948dd4e3b9b676a8c0d686ab06192b7
push id83949
push userhskupin@mozilla.com
push dateWed, 24 Apr 2019 19:43:28 +0000
treeherderautoland@b2677f62c9d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrwood
bugs1506928
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 1506928 - [raptor] Refactor arguments for constructors of Raptor classes. r=rwood Differential Revision: https://phabricator.services.mozilla.com/D25751
testing/raptor/raptor/raptor.py
--- a/testing/raptor/raptor/raptor.py
+++ b/testing/raptor/raptor/raptor.py
@@ -64,38 +64,40 @@ 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, memory_test=False,
-                 is_release_build=False, debug_mode=False, post_startup_delay=None, activity=None,
-                 intent=None):
+                 is_release_build=False, debug_mode=False, post_startup_delay=None, **kwargs):
 
         # 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
-        self.config['processor'] = mozinfo.processor
-        self.config['run_local'] = run_local
-        self.config['obj_path'] = obj_path
-        self.config['gecko_profile'] = gecko_profile
-        self.config['gecko_profile_interval'] = gecko_profile_interval
-        self.config['gecko_profile_entries'] = gecko_profile_entries
-        self.config['symbols_path'] = symbols_path
-        self.config['host'] = host
-        self.config['power_test'] = power_test
-        self.config['memory_test'] = memory_test
-        self.config['is_release_build'] = is_release_build
-        self.config['enable_control_server_wait'] = memory_test
+
+        self.config = {
+            'app': app,
+            'binary': binary,
+            'platform': mozinfo.os,
+            'processor': mozinfo.processor,
+            'run_local': run_local,
+            'obj_path': obj_path,
+            'gecko_profile': gecko_profile,
+            'gecko_profile_interval': gecko_profile_interval,
+            'gecko_profile_entries': gecko_profile_entries,
+            'symbols_path': symbols_path,
+            'host': host,
+            'power_test': power_test,
+            'memory_test': memory_test,
+            'is_release_build': is_release_build,
+            'enable_control_server_wait': memory_test,
+        }
+
         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 = post_startup_delay
@@ -415,25 +417,16 @@ class Raptor(object):
 
     def control_server_wait_clear(self, state):
         response = requests.post("http://127.0.0.1:%s/" % self.control_server.port,
                                  json={"type": "wait-clear", "data": state})
         return response.content
 
 
 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, memory_test=False,
-                 is_release_build=False, debug_mode=False, post_startup_delay=None, activity=None,
-                 intent=None):
-        Raptor.__init__(self, app, binary, run_local, obj_path, gecko_profile,
-                        gecko_profile_interval, gecko_profile_entries, symbols_path,
-                        host, power_test, memory_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],
         }
@@ -483,25 +476,16 @@ class RaptorDesktop(Raptor):
     def check_for_crashes(self):
         try:
             self.runner.check_for_crashes()
         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, memory_test=False,
-                 is_release_build=False, debug_mode=False, post_startup_delay=None, activity=None,
-                 intent=None):
-        RaptorDesktop.__init__(self, app, binary, run_local, obj_path, gecko_profile,
-                               gecko_profile_interval, gecko_profile_entries, symbols_path,
-                               host, power_test, memory_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"
 
@@ -529,25 +513,16 @@ class RaptorDesktopFirefox(RaptorDesktop
             self._init_gecko_profiling(test)
             # tell the control server the gecko_profile dir; the control server will
             # receive the actual gecko profiles from the web ext and will write them
             # 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, memory_test=False,
-                 is_release_build=False, debug_mode=False, post_startup_delay=None, activity=None,
-                 intent=None):
-        RaptorDesktop.__init__(self, app, binary, run_local, obj_path, gecko_profile,
-                               gecko_profile_interval, gecko_profile_entries, symbols_path,
-                               host, power_test, memory_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',
@@ -569,29 +544,25 @@ class RaptorDesktopChrome(RaptorDesktop)
 
         if test.get('playback', None) is not None:
             self.setup_chrome_desktop_for_playback()
 
         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, memory_test=False,
-                 is_release_build=False, debug_mode=False, post_startup_delay=None, activity=None,
-                 intent=None):
-        Raptor.__init__(self, app, binary, run_local, obj_path, gecko_profile,
-                        gecko_profile_interval, gecko_profile_entries, symbols_path, host,
-                        power_test, memory_test, is_release_build, debug_mode, post_startup_delay)
+    def __init__(self, app, binary, activity=None, intent=None, **kwargs):
+        super(RaptorAndroid, self).__init__(app, binary, **kwargs)
 
         # on android, when creating the browser profile, we want to use a 'firefox' type profile
         self.profile_class = "firefox"
-        self.config['activity'] = activity
-        self.config['intent'] = intent
+        self.config.update({
+            'activity': activity,
+            'intent': intent,
+        })
 
     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")
         self.device = ADBDevice(verbose=True)
         self.device.clear_logcat()
         self.clear_app_data()