Bug 1415674 - Allow skipping web-paltform-tests that timeout, r=ato draft
authorJames Graham <james@hoppipolla.co.uk>
Wed, 08 Nov 2017 13:07:09 -0800
changeset 695125 20c98b1f08cd86bf9d0f5249c55043bf8f6a5519
parent 692062 b5a3b8ef6902998507fc881b6d628b055457fe31
child 739536 a461ee8f38df99ac1f82f1f5a02ea18b0aba76f0
push id88357
push userbmo:james@hoppipolla.co.uk
push dateWed, 08 Nov 2017 21:10:28 +0000
reviewersato
bugs1415674
milestone58.0a1
Bug 1415674 - Allow skipping web-paltform-tests that timeout, r=ato For local runs it can be helpful to skip tests are expected to time out. This adds a --skip-timeout flag that will skip tests that are expected to time out on the current platform. It doesn't solve the problem that the metadata might be over-specific in the case that the expectation data isn't universal across all platforms. MozReview-Commit-ID: 7S4EsVKv33P
testing/web-platform/tests/tools/wptrunner/wptrunner/testloader.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/testloader.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/testloader.py
@@ -443,28 +443,30 @@ class TestLoader(object):
                  test_manifests,
                  test_types,
                  run_info,
                  manifest_filters=None,
                  meta_filters=None,
                  chunk_type="none",
                  total_chunks=1,
                  chunk_number=1,
-                 include_https=True):
+                 include_https=True,
+                 skip_timeout=False):
 
         self.test_types = test_types
         self.run_info = run_info
 
         self.manifest_filters = manifest_filters if manifest_filters is not None else []
         self.meta_filters = meta_filters if meta_filters is not None else []
 
         self.manifests = test_manifests
         self.tests = None
         self.disabled_tests = None
         self.include_https = include_https
+        self.skip_timeout = skip_timeout
 
         self.chunk_type = chunk_type
         self.total_chunks = total_chunks
         self.chunk_number = chunk_number
 
         self.chunker = {"none": Unchunked,
                         "hash": HashChunker,
                         "dir_hash": DirectoryHashChunker,
@@ -540,16 +542,18 @@ class TestLoader(object):
         """Read in the tests from the manifest file and add them to a queue"""
         tests = {"enabled":defaultdict(list),
                  "disabled":defaultdict(list)}
 
         for test_path, test_type, test in self.iter_tests():
             enabled = not test.disabled()
             if not self.include_https and test.environment["protocol"] == "https":
                 enabled = False
+            if self.skip_timeout and test.expected() == "TIMEOUT":
+                enabled = False
             key = "enabled" if enabled else "disabled"
             tests[key][test_type].append(test)
 
         self.tests = tests["enabled"]
         self.disabled_tests = tests["disabled"]
 
     def groups(self, test_types, chunk_type="none", total_chunks=1, chunk_number=1):
         groups = set()
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
@@ -84,16 +84,18 @@ scheme host and port.""")
                                       choices=wpttest.enabled_tests,
                                       help="Test types to run")
     test_selection_group.add_argument("--include", action="append",
                                       help="URL prefix to include")
     test_selection_group.add_argument("--exclude", action="append",
                                       help="URL prefix to exclude")
     test_selection_group.add_argument("--include-manifest", type=abs_path,
                                       help="Path to manifest listing tests to include")
+    test_selection_group.add_argument("--skip-timeout", action="store_true",
+                                      help="Skip tests that are expected to time out")
     test_selection_group.add_argument("--tag", action="append", dest="tags",
                                       help="Labels applied to tests to include in the run. Labels starting dir: are equivalent to top-level directories.")
 
     debugging_group = parser.add_argument_group("Debugging")
     debugging_group.add_argument('--debugger', const="__default__", nargs="?",
                                  help="run under a debugger, e.g. gdb or valgrind")
     debugging_group.add_argument('--debugger-args', help="arguments to the debugger")
     debugging_group.add_argument("--rerun", action="store", type=int, default=1,
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
@@ -33,16 +33,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=None, run_info_extras=None, **kwargs):
     if run_info_extras is None:
         run_info_extras = {}
 
     run_info = wpttest.get_run_info(kwargs["run_info"], product, debug=debug,
                                     extras=run_info_extras)
 
     test_manifests = testloader.ManifestLoader(test_paths, force_manifest_update=kwargs["manifest_update"]).load()
@@ -61,19 +62,21 @@ def get_loader(test_paths, product, ssl_
     test_loader = testloader.TestLoader(test_manifests,
                                         kwargs["test_types"],
                                         run_info,
                                         manifest_filters=manifest_filters,
                                         meta_filters=meta_filters,
                                         chunk_type=kwargs["chunk_type"],
                                         total_chunks=kwargs["total_chunks"],
                                         chunk_number=kwargs["this_chunk"],
-                                        include_https=ssl_env.ssl_enabled)
+                                        include_https=ssl_env.ssl_enabled,
+                                        skip_timeout=kwargs["skip_timeout"])
     return run_info, test_loader
 
+
 def list_test_groups(test_paths, product, **kwargs):
     env.do_delayed_imports(logger, test_paths)
 
     ssl_env = env.ssl_env(logger, **kwargs)
 
     run_info_extras = products.load_product(kwargs["config"], product)[-1](**kwargs)
 
     run_info, test_loader = get_loader(test_paths, product, ssl_env,
@@ -211,17 +214,16 @@ def run_tests(config, test_paths, produc
                     else:
                         browser_cls = target_browser_cls
 
                     browser_kwargs = get_browser_kwargs(test_type,
                                                         run_info,
                                                         ssl_env=ssl_env,
                                                         **kwargs)
 
-
                     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: