Bug 1484659 - Handle wpt version number changes, r=ato
authorJames Graham <james@hoppipolla.co.uk>
Mon, 20 Aug 2018 12:05:22 +0000
changeset 432423 edaf8fd303bbf226b740e09dc22ecb1163602da1
parent 432422 77eac13df6ece3efdd5be3e47df0a3909dd396cb
child 432424 9648d9afdd2a37674616bed74dbd51a82f6c6060
push id106731
push usershindli@mozilla.com
push dateMon, 20 Aug 2018 16:36:25 +0000
treeherdermozilla-inbound@14ef4dec6126 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1484659
milestone63.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 1484659 - Handle wpt version number changes, r=ato If the wpt manifest format changes we bump the version number, causing loading the old manifest to throw an error. We weren't correctly handling this error when trying to update the manifest (by creating a new empty manifest) so updates after the version number changed broke. MozReview-Commit-ID: 4H1nMtRI9PZ Differential Revision: https://phabricator.services.mozilla.com/D3771
python/mozbuild/mozbuild/testing.py
testing/web-platform/manifestupdate.py
--- a/python/mozbuild/mozbuild/testing.py
+++ b/python/mozbuild/mozbuild/testing.py
@@ -295,9 +295,15 @@ def read_wpt_manifest(context, paths):
         paths_file = os.path.join(context.config.topsrcdir, "testing",
                                   "web-platform", "tests", "tools", "localpaths.py")
         _globals = {"__file__": paths_file}
         execfile(paths_file, _globals)
         import manifest as wptmanifest
     finally:
         sys.path = old_path
         f = context._finder.get(full_path)
-        return wptmanifest.manifest.load(tests_root, f)
+        try:
+            rv = wptmanifest.manifest.load(tests_root, f)
+        except wptmanifest.manifest.ManifestVersionMismatch:
+            # If we accidentially end up with a committed manifest that's the wrong
+            # version, then return an empty manifest here just to not break the build
+            rv = wptmanifest.manifest.Manifest()
+        return rv
--- a/testing/web-platform/manifestupdate.py
+++ b/testing/web-platform/manifestupdate.py
@@ -4,21 +4,23 @@ import os
 import sys
 from collections import defaultdict
 
 from mozlog.structured import commandline
 from wptrunner.wptcommandline import get_test_paths, set_from_config
 
 manifest = None
 
+
 def do_delayed_imports(wpt_dir):
     global manifest
     sys.path.insert(0, os.path.join(wpt_dir, "tools", "manifest"))
     import manifest
 
+
 def create_parser():
     p = argparse.ArgumentParser()
     p.add_argument("--check-clean", action="store_true",
                    help="Check that updating the manifest doesn't lead to any changes")
     p.add_argument("--rebuild", action="store_true",
                    help="Rebuild the manifest from scratch")
     commandline.add_logging_group(p)
 
@@ -42,20 +44,24 @@ def update(logger, wpt_dir, check_clean=
         return _check_clean(logger, test_paths)
 
     return _update(logger, test_paths, rebuild)
 
 
 def _update(logger, test_paths, rebuild):
     for url_base, paths in test_paths.iteritems():
         manifest_path = os.path.join(paths["metadata_path"], "MANIFEST.json")
-        if rebuild:
+        m = None
+        if not rebuild:
+            try:
+                m = manifest.manifest.load(paths["tests_path"], manifest_path)
+            except manifest.manifest.ManifestVersionMismatch:
+                logger.info("Manifest format changed, rebuilding")
+        if m is None:
             m = manifest.manifest.Manifest(url_base)
-        else:
-            m = manifest.manifest.load(paths["tests_path"], manifest_path)
         manifest.update.update(paths["tests_path"], m, working_copy=True)
         manifest.manifest.write(m, manifest_path)
     return 0
 
 
 def _check_clean(logger, test_paths):
     manifests_by_path = {}
     rv = 0