Setup debug builds to have a longer timeout
authorJames Graham <james@hoppipolla.co.uk>
Tue, 31 Mar 2015 19:22:08 +0100
changeset 326776 3116e1bb2004e56b83bf33ca0bd6d43e7cbe4b44
parent 326775 cf872d7c1f8429e8685af81804f9da0a6af2b07a
child 326777 9152bfcbfdbe458645b9581600b6df77eab9138e
push id10169
push userdminor@mozilla.com
push dateThu, 28 Jan 2016 13:10:48 +0000
milestone39.0a1
Setup debug builds to have a longer timeout
testing/web-platform/harness/wptrunner/browsers/b2g.py
testing/web-platform/harness/wptrunner/browsers/chrome.py
testing/web-platform/harness/wptrunner/browsers/firefox.py
testing/web-platform/harness/wptrunner/browsers/servo.py
testing/web-platform/harness/wptrunner/wptcommandline.py
testing/web-platform/harness/wptrunner/wptrunner.py
testing/web-platform/harness/wptrunner/wpttest.py
--- a/testing/web-platform/harness/wptrunner/browsers/b2g.py
+++ b/testing/web-platform/harness/wptrunner/browsers/b2g.py
@@ -36,17 +36,18 @@ def check_args(**kwargs):
     pass
 
 
 def browser_kwargs(test_environment, **kwargs):
     return {"prefs_root": kwargs["prefs_root"],
             "no_backup": kwargs.get("b2g_no_backup", False)}
 
 
-def executor_kwargs(test_type, server_config, cache_manager, **kwargs):
+def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
+                    **kwargs):
     timeout_multiplier = kwargs["timeout_multiplier"]
     if timeout_multiplier is None:
         timeout_multiplier = 2
 
     executor_kwargs = {"server_config": server_config,
                        "timeout_multiplier": timeout_multiplier,
                        "close_after_done": False}
 
--- a/testing/web-platform/harness/wptrunner/browsers/chrome.py
+++ b/testing/web-platform/harness/wptrunner/browsers/chrome.py
@@ -23,17 +23,18 @@ def check_args(**kwargs):
     require_arg(kwargs, "binary")
 
 
 def browser_kwargs(**kwargs):
     return {"binary": kwargs["binary"],
             "webdriver_binary": kwargs["webdriver_binary"]}
 
 
-def executor_kwargs(test_type, server_config, cache_manager, **kwargs):
+def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
+                    **kwargs):
     from selenium.webdriver import DesiredCapabilities
 
     executor_kwargs = base_executor_kwargs(test_type, server_config,
                                            cache_manager, **kwargs)
     executor_kwargs["close_after_done"] = True
     executor_kwargs["capabilities"] = dict(DesiredCapabilities.CHROME.items() +
                                            {"chromeOptions":
                                             {"binary": kwargs["binary"]}}.items())
--- a/testing/web-platform/harness/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/harness/wptrunner/browsers/firefox.py
@@ -40,20 +40,23 @@ def browser_kwargs(**kwargs):
             "debug_args": kwargs["debug_args"],
             "interactive": kwargs["interactive"],
             "symbols_path": kwargs["symbols_path"],
             "stackwalk_binary": kwargs["stackwalk_binary"],
             "certutil_binary": kwargs["certutil_binary"],
             "ca_certificate_path": kwargs["ssl_env"].ca_cert_path()}
 
 
-def executor_kwargs(test_type, server_config, cache_manager, **kwargs):
+def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
+                    **kwargs):
     executor_kwargs = base_executor_kwargs(test_type, server_config,
                                            cache_manager, **kwargs)
     executor_kwargs["close_after_done"] = True
+    if run_info_data["debug"] and kwargs["timeout_multiplier"] is None:
+        executor_kwargs["timeout_multiplier"] = 2
     return executor_kwargs
 
 
 def env_options():
     return {"host": "127.0.0.1",
             "external_host": "web-platform.test",
             "bind_hostname": "false",
             "certificate_domain": "web-platform.test",
--- a/testing/web-platform/harness/wptrunner/browsers/servo.py
+++ b/testing/web-platform/harness/wptrunner/browsers/servo.py
@@ -25,17 +25,18 @@ def check_args(**kwargs):
 
 
 def browser_kwargs(**kwargs):
     return {"binary": kwargs["binary"],
             "debug_args": kwargs["debug_args"],
             "interactive": kwargs["interactive"]}
 
 
-def executor_kwargs(test_type, server_config, cache_manager, **kwargs):
+def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
+                    **kwargs):
     rv = base_executor_kwargs(test_type, server_config,
                               cache_manager, **kwargs)
     rv["pause_after_test"] = kwargs["pause_after_test"]
     return rv
 
 def env_options():
     return {"host": "localhost",
             "bind_hostname": "true",
--- a/testing/web-platform/harness/wptrunner/wptcommandline.py
+++ b/testing/web-platform/harness/wptrunner/wptcommandline.py
@@ -87,16 +87,24 @@ def create_parser(product_choices=None):
 
     parser.add_argument("--list-test-groups", action="store_true",
                         default=False,
                         help="List the top level directories containing tests that will run.")
     parser.add_argument("--list-disabled", action="store_true",
                         default=False,
                         help="List the tests that are disabled on the current platform")
 
+    build_type = parser.add_mutually_exclusive_group()
+    build_type.add_argument("--debug-build", dest="debug", action="store_true",
+                            default=None,
+                            help="Build is a debug build (overrides any mozinfo file)")
+    build_type.add_argument("--release-build", dest="debug", action="store_false",
+                            default=None,
+                            help="Build is a release (overrides any mozinfo file)")
+
     test_selection_group = parser.add_argument_group("Test Selection")
     test_selection_group.add_argument("--test-types", action="store",
                                       nargs="*", default=["testharness", "reftest"],
                                       choices=["testharness", "reftest"],
                                       help="Test types to run")
     test_selection_group.add_argument("--include", action="append", type=slash_prefixed,
                                       help="URL prefix to include")
     test_selection_group.add_argument("--exclude", action="append", type=slash_prefixed,
--- a/testing/web-platform/harness/wptrunner/wptrunner.py
+++ b/testing/web-platform/harness/wptrunner/wptrunner.py
@@ -35,17 +35,17 @@ The upstream repository has the facility
 format. This manifest is used directly to determine which tests exist. Local
 metadata files are used to store the expected test results.
 """
 
 def setup_logging(*args, **kwargs):
     global logger
     logger = wptlogging.setup(*args, **kwargs)
 
-def get_loader(test_paths, product, ssl_env, debug=False, **kwargs):
+def get_loader(test_paths, product, ssl_env, debug=None, **kwargs):
     run_info = wpttest.get_run_info(kwargs["run_info"], product, debug=debug)
 
     test_manifests = testloader.ManifestLoader(test_paths, force_manifest_update=kwargs["manifest_update"]).load()
 
     test_filter = testloader.TestFilter(include=kwargs["include"],
                                         exclude=kwargs["exclude"],
                                         manifest_path=kwargs["include_manifest"],
                                         test_manifests=test_manifests)
@@ -106,17 +106,17 @@ def run_tests(config, test_paths, produc
          executor_classes, get_executor_kwargs,
          env_options) = products.load_product(config, product)
 
         ssl_env = env.ssl_env(logger, **kwargs)
 
         check_args(**kwargs)
 
         if "test_loader" in kwargs:
-            run_info = wpttest.get_run_info(kwargs["run_info"], product, debug=False)
+            run_info = wpttest.get_run_info(kwargs["run_info"], product, debug=None)
             test_loader = kwargs["test_loader"]
         else:
             run_info, test_loader = get_loader(test_paths, product, ssl_env,
                                                **kwargs)
 
         if kwargs["run_by_dir"] is False:
             test_source_cls = testloader.SingleTestSource
             test_source_kwargs = {}
@@ -157,16 +157,17 @@ def run_tests(config, test_paths, produc
                     for test in test_loader.disabled_tests[test_type]:
                         logger.test_start(test.id)
                         logger.test_end(test.id, status="SKIP")
 
                     executor_cls = executor_classes.get(test_type)
                     executor_kwargs = get_executor_kwargs(test_type,
                                                           test_environment.external_config,
                                                           test_environment.cache_manager,
+                                                          run_info,
                                                           **kwargs)
 
                     if executor_cls is None:
                         logger.error("Unsupported test type %s for product %s" %
                                      (test_type, product))
                         continue
 
 
--- a/testing/web-platform/harness/wptrunner/wpttest.py
+++ b/testing/web-platform/harness/wptrunner/wpttest.py
@@ -53,18 +53,21 @@ def get_run_info(metadata_root, product,
         return RunInfo(metadata_root, product, **kwargs)
 
 
 class RunInfo(dict):
     def __init__(self, metadata_root, product, debug):
         self._update_mozinfo(metadata_root)
         self.update(mozinfo.info)
         self["product"] = product
-        if not "debug" in self:
+        if debug is not None:
             self["debug"] = debug
+        elif "debug" not in self:
+            # Default to release
+            self["debug"] = False
 
     def _update_mozinfo(self, metadata_root):
         """Add extra build information from a mozinfo.json file in a parent
         directory"""
         path = metadata_root
         dirs = set()
         while path != os.path.expanduser('~'):
             if path in dirs: