Commit b77a27f4 authored by Stephen McGruer's avatar Stephen McGruer Committed by Chromium LUCI CQ

Roll wpt tooling.

This rolls up to WPT SHA e04f27b9946175edab6c09421ab5ceaa14b84539

This drops the cherry-pick of 0dd83ea7,
as the upstream version of that change has now landed.

Bug: 1160108
Change-Id: I6fdbb8f1453d3b6d70743614e60eaf26f9e2d29a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611551Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarJason Chase <chasej@chromium.org>
Commit-Queue: Jason Chase <chasej@chromium.org>
Auto-Submit: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841054}
parent 5508f300
......@@ -22,7 +22,7 @@ Local Modifications: None
Name: web-platform-tests - Test Suites for Web Platform specifications
Short Name: wpt
URL: https://github.com/web-platform-tests/wpt/
Version: d3ce095fcc6b5a85e6056fdebbf939caf2e2719f
Version: e04f27b9946175edab6c09421ab5ceaa14b84539
License: LICENSES FOR W3C TEST SUITES (https://www.w3.org/Consortium/Legal/2008/03-bsd-license.html)
License File: wpt/wpt/LICENSE.md
Security Critical: no
......
......@@ -9,7 +9,7 @@ cd $DIR
TARGET_DIR=$DIR/wpt
REMOTE_REPO="https://github.com/web-platform-tests/wpt.git"
WPT_HEAD=d3ce095fcc6b5a85e6056fdebbf939caf2e2719f
WPT_HEAD=e04f27b9946175edab6c09421ab5ceaa14b84539
function clone {
# Remove existing repo if already exists.
......
import logging
import sys
logger = logging.getLogger("manifest")
def setup():
def enable_debug_logging():
# type: () -> None
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(logging.BASIC_FORMAT, None)
handler.setFormatter(formatter)
logger.addHandler(handler)
def get_logger():
# type: () -> logging.Logger
......
......@@ -174,6 +174,8 @@ class Manifest(object):
constructed in the case we are not updating a path, but the absence of an item from
the iterator may be used to remove defunct entries from the manifest."""
logger = get_logger()
changed = False
# Create local variable references to these dicts so we avoid the
......@@ -222,31 +224,33 @@ class Manifest(object):
to_update.append(source_file)
if to_update:
logger.debug("Computing manifest update for %s items" % len(to_update))
changed = True
# 25 items was derived experimentally (2020-01) to be approximately the
# point at which it is quicker to create a Pool and parallelize update.
if parallel and len(to_update) > 25 and cpu_count() > 1:
# On Windows desktops with high cpu count, we are seeing issues
# with high CPU counts and multiprocessing. This is a temporary
# workaround until we add logic to WPT to select a max number of
# processes. See https://crbug.com/1160108
# On Python 3 on Windows, using >= MAXIMUM_WAIT_OBJECTS processes
# causes a crash in the multiprocessing module. Whilst this enum
# can technically have any value, it is usually 64. For safety,
# restrict manifest regeneration to 48 processes on Windows.
#
# 25 was experimentally determined to work in
# https://crbug.com/1160108#c22
# See https://bugs.python.org/issue26903 and https://bugs.python.org/issue40263
processes = cpu_count()
if sys.platform == "win32" and processes > 25:
processes = 25
# 25 derived experimentally (2020-01) to be approximately
# the point at which it is quicker to create Pool and
# parallelize this
if sys.platform == "win32" and processes > 48:
processes = 48
pool = Pool(processes)
# chunksize set > 1 when more than 10000 tests, because
# chunking is a net-gain once we get to very large numbers
# of items (again, experimentally, 2020-01)
chunksize = max(1, len(to_update) // 10000)
logger.debug("Doing a multiprocessed update. CPU count: %s, "
"processes: %s, chunksize: %s" % (cpu_count(), processes, chunksize))
results = pool.imap_unordered(compute_manifest_items,
to_update,
chunksize=max(1, len(to_update) // 10000)
chunksize=chunksize
) # type: Iterator[Tuple[Tuple[Text, ...], Text, Set[ManifestItem], Text]]
elif PY3:
results = map(compute_manifest_items, to_update)
......@@ -456,6 +460,7 @@ def _load_and_update(tests_root, # type: Text
update = True
if rebuild or update:
logger.info("Updating manifest")
for retry in range(2):
try:
tree = vcs.get_tree(tests_root, manifest, manifest_path, cache_root,
......
......@@ -4,7 +4,7 @@ import os
from . import manifest
from . import vcs
from .log import get_logger
from .log import get_logger, enable_debug_logging
from .download import download_from_github
here = os.path.dirname(__file__)
......@@ -64,6 +64,9 @@ def abs_path(path):
def create_parser():
# type: () -> argparse.ArgumentParser
parser = argparse.ArgumentParser()
parser.add_argument(
"-v", "--verbose", dest="verbose", action="store_true", default=False,
help="Turn on verbose logging")
parser.add_argument(
"-p", "--path", type=abs_path, help="Path to manifest file.")
parser.add_argument(
......@@ -90,6 +93,8 @@ def run(*args, **kwargs):
# type: (*Any, **Any) -> None
if kwargs["path"] is None:
kwargs["path"] = os.path.join(kwargs["tests_root"], "MANIFEST.json")
if kwargs["verbose"]:
enable_debug_logging()
update_from_cli(**kwargs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment