Bug 1461042 [wpt PR 10971] - Add git revision to run_info (and wptreport), a=testonly
authorRobert Ma <bob1211@gmail.com>
Sat, 19 May 2018 20:35:27 +0000
changeset 419084 5ec35f197df64c2c1901fd05999e837bb1349175
parent 419083 f8c7a3a58dbd51c01ef30b024638228aaec58694
child 419085 6d59c2e00ab1554c91cd700eedf09266e0d6d688
push id34026
push userapavel@mozilla.com
push dateMon, 21 May 2018 09:47:33 +0000
treeherdermozilla-central@dc1868d255be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1461042, 10971
milestone62.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 1461042 [wpt PR 10971] - Add git revision to run_info (and wptreport), a=testonly Automatic update from web-platform-testsAdd git revision to run_info (and wptreport) (#10971) -- wpt-commits: 15f9e082e6a532cb06c5f666ee3b7833fadf2500 wpt-pr: 10971
testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
@@ -1,9 +1,10 @@
 import os
+import subprocess
 from collections import defaultdict
 
 from wptmanifest.parser import atoms
 
 atom_reset = atoms["Reset"]
 enabled_tests = set(["testharness", "reftest", "wdspec"])
 
 
@@ -62,19 +63,28 @@ class WdspecSubtestResult(SubtestResult)
 
 def get_run_info(metadata_root, product, **kwargs):
     return RunInfo(metadata_root, product, **kwargs)
 
 
 class RunInfo(dict):
     def __init__(self, metadata_root, product, debug, browser_version=None, extras=None):
         import mozinfo
-
         self._update_mozinfo(metadata_root)
         self.update(mozinfo.info)
+
+        from update.tree import GitTree
+        try:
+            # GitTree.__init__ throws if we are not in a git tree.
+            rev = GitTree().rev
+        except subprocess.CalledProcessError:
+            rev = None
+        if rev:
+            self["revision"] = rev
+
         self["product"] = product
         if debug is not None:
             self["debug"] = debug
         elif "debug" not in self:
             # Default to release
             self["debug"] = False
         if product == "firefox" and "stylo" not in self:
             self["stylo"] = False