Bug 1441488 [wpt PR 9392] - Don't download gecko prefs file if it's reasonably new, a=testonly
authorJames Graham <james@hoppipolla.co.uk>
Tue, 27 Feb 2018 17:42:37 +0000
changeset 461096 51facb4707db380de1922e309681b81336443944
parent 461095 57d5a52e7e8f2398aa9368ce2998309d51fe8c93
child 461097 98bbe1ad5f692aec8def8c4ac9a15869025328d3
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1441488
milestone60.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 1441488 [wpt PR 9392] - Don't download gecko prefs file if it's reasonably new, a=testonly Automatic update from web-platform-tests <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/w3c/web-platform-tests/9392) <!-- Reviewable:end --> wpt-commits: 119c443cdbf5b80d53d111c579d782a9d70d51df wpt-pr: 9392 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2
testing/web-platform/tests/tools/wpt/browser.py
--- a/testing/web-platform/tests/tools/wpt/browser.py
+++ b/testing/web-platform/tests/tools/wpt/browser.py
@@ -3,16 +3,17 @@ import os
 import platform
 import re
 import shutil
 import stat
 import subprocess
 import sys
 from abc import ABCMeta, abstractmethod
 from ConfigParser import RawConfigParser
+from datetime import datetime, timedelta
 from distutils.spawn import find_executable
 from io import BytesIO
 
 from utils import call, get, untar, unzip
 
 logger = logging.getLogger(__name__)
 
 uname = platform.uname()
@@ -153,19 +154,25 @@ class Firefox(Browser):
 
     def install_prefs(self, dest=None):
         if dest is None:
             dest = os.pwd
 
         dest = os.path.join(dest, "profiles")
         if not os.path.exists(dest):
             os.makedirs(dest)
-        with open(os.path.join(dest, "prefs_general.js"), "wb") as f:
-            resp = get("https://hg.mozilla.org/mozilla-central/raw-file/tip/testing/profiles/prefs_general.js")
-            f.write(resp.content)
+        prefs_path = os.path.join(dest, "prefs_general.js")
+
+        now = datetime.now()
+        if (not os.path.exists(prefs_path) or
+            (datetime.fromtimestamp(os.stat(prefs_path).st_mtime) <
+             now - timedelta(days=2))):
+            with open(prefs_path, "wb") as f:
+                resp = get("https://hg.mozilla.org/mozilla-central/raw-file/tip/testing/profiles/prefs_general.js")
+                f.write(resp.content)
 
         return dest
 
     def _latest_geckodriver_version(self):
         """Get and return latest version number for geckodriver."""
         # This is used rather than an API call to avoid rate limits
         tags = call("git", "ls-remote", "--tags", "--refs",
                     "https://github.com/mozilla/geckodriver.git")