Bug 1064893 - Update to latest version of wptrunner, r=Ms2ger

--HG--
extra : rebase_source : 14adf6bd495b81a3a12f97f777ec339522ca7ebe
This commit is contained in:
James Graham 2014-09-12 20:04:18 +01:00
parent db2eb02266
commit 6c348afbf2
5 changed files with 85 additions and 29 deletions

View File

@ -92,8 +92,7 @@ wptupdate takes several useful options:
mercurial tree).
``--patch``
Create a branch containing a git commit, or a mq patch with the
changes made by wptupdate.
Create a a git commit, or a mq patch, with the changes made by wptupdate.
``--ignore-existing``
Overwrite all the expectation data for any tests that have a result

View File

@ -4,12 +4,10 @@
import os
import mozcrash
from mozprocess import ProcessHandler
from mozprofile import FirefoxProfile, Preferences
from mozprofile.permissions import ServerLocations
from mozrunner import FirefoxRunner
import mozcrash
from mozcrash import mozcrash
from .base import get_free_port, Browser, ExecutorBrowser, require_arg, cmd_arg

View File

@ -42,15 +42,16 @@ def update_manifest(git_root, metadata_root):
def update_expected(test_root, metadata_root, log_file_names, rev_old=None, rev_new="HEAD",
ignore_existing=False):
ignore_existing=False, sync_root=None):
"""Update the metadata files for web-platform-tests based on
the results obtained in a previous run"""
manifest = load_test_manifest(test_root, metadata_root)
if rev_old is not None:
rev_old = git("rev-parse", rev_old, repo=test_root).strip()
rev_new = git("rev-parse", rev_new, repo=test_root).strip()
if sync_root is not None:
if rev_old is not None:
rev_old = git("rev-parse", rev_old, repo=test_root).strip()
rev_new = git("rev-parse", rev_new, repo=test_root).strip()
if rev_old is not None:
change_data = load_change_data(rev_old, rev_new, repo=test_root)

View File

@ -17,6 +17,36 @@ import wptcommandline
base_path = os.path.abspath(os.path.split(__file__)[0])
bsd_license = """W3C 3-clause BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of works must retain the original copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the original copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the W3C nor the names of its contributors may be
used to endorse or promote products derived from this work without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
def do_test_relative_imports(test_root):
global manifest
@ -119,6 +149,12 @@ class WebPlatformTests(object):
dest_path = os.path.join(dest, destination, os.path.split(source)[1])
shutil.copy2(source_path, dest_path)
self.add_license(dest)
def add_license(self, dest):
with open(os.path.join(dest, "LICENSE"), "w") as f:
f.write(bsd_license)
class NoVCSTree(object):
name = "non-vcs"
@ -179,10 +215,17 @@ class HgTree(object):
try:
self.hg("qinit")
except subprocess.CalledProcessError:
# There is already a patch queue in this repo
# Should only happen during development
pass
self.hg("qnew", patch_name, "-X", self.root, "-m", message)
patch_names = [item.strip() for item in self.hg("qseries").split("\n") if item.strip()]
suffix = 0
test_name = patch_name
while test_name in patch_names:
suffix += 1
test_name = "%s-%i" % (patch_name, suffix)
self.hg("qnew", test_name, "-X", self.root, "-m", message)
def update_patch(self, include=None):
if include is not None:
@ -227,9 +270,8 @@ class GitTree(object):
self.git("add", *args)
def create_patch(self, patch_name, message):
# In git a patch is actually a branch
# In git a patch is actually a commit
self.message = message
self.git("checkout", "-b", patch_name)
def update_patch(self, include=None):
assert self.message is not None
@ -289,20 +331,27 @@ def sync_tests(paths, local_tree, wpt, bug):
return initial_manifest, new_manifest
def update_metadata(paths, local_tree, wpt, initial_rev, bug, log_files, ignore_existing):
def update_metadata(paths, local_tree, initial_rev, bug, log_files, ignore_existing,
wpt_repo=None):
try:
try:
local_tree.create_patch("web-platform-tests_update_%s_metadata" % wpt.rev,
"Update web-platform-tests expected data to revision %s" %
wpt.rev)
if wpt_repo is not None:
name = "web-platform-tests_update_%s_metadata" % wpt_repo.rev
message = "Update web-platform-tests expected data to revision %s" % wpt_repo.rev
else:
name = "web-platform-tests_update_metadata"
message = "Update web-platform-tests expected data"
local_tree.create_patch(name, message)
except subprocess.CalledProcessError:
# Patch with that name already exists, probably
pass
needs_human = metadata.update_expected(paths["sync"],
needs_human = metadata.update_expected(paths["test"],
paths["metadata"],
log_files,
rev_old=initial_rev,
ignore_existing=ignore_existing)
ignore_existing=ignore_existing,
sync_root=paths.get("sync", None))
if needs_human:
#TODO: List all the files that should be checked carefully for changes.
@ -321,10 +370,12 @@ def update_metadata(paths, local_tree, wpt, initial_rev, bug, log_files, ignore_
def run_update(**kwargs):
config = kwargs["config"]
paths = {"sync": kwargs["sync_path"],
"test": kwargs["tests_root"],
paths = {"test": kwargs["tests_root"],
"metadata": kwargs["metadata_root"]}
if kwargs["sync"]:
paths["sync"] = kwargs["sync_path"]
for path in paths.itervalues():
ensure_exists(path)
@ -352,19 +403,26 @@ expected data."""
if rev is None:
rev = config["web-platform-tests"].get("branch", "master")
wpt = WebPlatformTests(config["web-platform-tests"]["remote_url"],
paths["sync"],
rev=rev)
bug = None
initial_rev = None
wpt_repo = None
if kwargs["sync"]:
initial_manifest, new_manifest = sync_tests(paths, local_tree, wpt, bug)
wpt_repo = WebPlatformTests(config["web-platform-tests"]["remote_url"],
paths["sync"],
rev=rev)
initial_manifest, new_manifest = sync_tests(paths, local_tree, wpt_repo, bug)
initial_rev = initial_manifest.rev
if kwargs["run_log"]:
update_metadata(paths, local_tree, wpt, initial_rev, bug,
kwargs["run_log"], kwargs["ignore_existing"])
update_metadata(paths,
local_tree,
initial_rev,
bug,
kwargs["run_log"],
kwargs["ignore_existing"],
wpt_repo=wpt_repo)
def main():

View File

@ -101,7 +101,7 @@ def create_parser(product_choices=None):
help="Halt the test runner when an unexpected result is encountered")
parser.add_argument("--symbols-path", action="store", type=url_or_path,
help="Path to symbols file used to analyse crash minidumps.")
help="Path or url to symbols file used to analyse crash minidumps.")
parser.add_argument("--stackwalk-binary", action="store", type=abs_path,
help="Path to stackwalker program used to analyse minidumps.")
@ -198,7 +198,7 @@ def create_parser_update():
parser.add_argument("--no-check-clean", action="store_true", default=False,
help="Don't check the working directory is clean before updating")
parser.add_argument("--patch", action="store_true",
help="Create an mq patch or git branch+commit containing the changes.")
help="Create an mq patch or git commit containing the changes.")
parser.add_argument("--sync", dest="sync", action="store_true", default=False,
help="Sync the tests with the latest from upstream")
parser.add_argument("--ignore-existing", action="store_true", help="When updating test results only consider results from the logfiles provided, not existing expectations.")