Bug 1451159 - [testing/profiles] Store profile data in actual profile look alike folders r=gbrown
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 19 Apr 2018 16:12:26 -0400
changeset 470532 9a2ba1c7b0ec32f81e067acd2610e47b9be7d764
parent 470531 05cf749971979f41084cd6e1d501035e329d9d9d
child 470533 5f1efa279b095f6ab27ed903e8384615538aac90
push id9184
push userarchaeopteryx@coole-files.de
push dateSun, 06 May 2018 20:01:47 +0000
treeherdermozilla-beta@4632e7d90224 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1451159
milestone61.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 1451159 - [testing/profiles] Store profile data in actual profile look alike folders r=gbrown This moves testing/profiles/prefs_general.js to testing/profiles/common/user.js. It also adds an 'extensions' folder to the common profile. Dropping extension files here will get them installed in all test harnesses (useful for testing on try). The idea is that all test harnesses will eventually use this 'common' profile. We'll also create some new per harness profiles, e.g testing/profiles/mochitest and testing/profiles/reftest. This way there will be a single location developers can go to set preferences, both for a specific harness, and across all harnesses. MozReview-Commit-ID: 8sqBqLiypgU
CLOBBER
browser/base/content/test/general/browser_audioTabIcon.js
browser/components/enterprisepolicies/tests/browser/disable_fxscreenshots/browser_policy_disable_fxscreenshots.js
browser/extensions/pocket/test/head.js
build/automation.py.in
build/pgo/profileserver.py
build/valgrind/mach_commands.py
taskcluster/ci/source-test/python.yml
testing/mochitest/runjunit.py
testing/mochitest/runtests.py
testing/profiles/common/extensions/README.txt
testing/profiles/common/user.js
testing/profiles/moz.build
testing/profiles/prefs_general.js
testing/testsuite-targets.mk
testing/web-platform/tests/tools/wpt/browser.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1453317 - Update VS2017 used for builds in automation to version 15.6.6.
+Bug 1451159 - Moved testing/profiles/prefs_general.js (prevents symlinked file does not exist)
--- a/browser/base/content/test/general/browser_audioTabIcon.js
+++ b/browser/base/content/test/general/browser_audioTabIcon.js
@@ -71,18 +71,19 @@ async function pause(tab, options) {
       await awaitDOMAudioPlaybackStopped;
       ok(tab.hasAttribute("soundplaying"), "The tab should still have the soundplaying attribute immediately after DOMAudioPlaybackStopped");
     }
 
     await wait_for_tab_playing_event(tab, false);
     ok(!tab.hasAttribute("soundplaying"), "The tab should not have the soundplaying attribute after the timeout has resolved");
   } finally {
     // Make sure other tests don't timeout if an exception gets thrown above.
-    // Need to use setIntPref instead of clearUserPref because prefs_general.js
-    // overrides the default value to help this and other tests run faster.
+    // Need to use setIntPref instead of clearUserPref because
+    // testing/profiles/common/user.js overrides the default value to help this and
+    // other tests run faster.
     Services.prefs.setIntPref(TABATTR_REMOVAL_PREFNAME, INITIAL_TABATTR_REMOVAL_DELAY_MS);
   }
 }
 
 async function hide_tab(tab) {
   let tabHidden = BrowserTestUtils.waitForEvent(tab, "TabHide");
   gBrowser.hideTab(tab);
   return tabHidden;
--- a/browser/components/enterprisepolicies/tests/browser/disable_fxscreenshots/browser_policy_disable_fxscreenshots.js
+++ b/browser/components/enterprisepolicies/tests/browser/disable_fxscreenshots/browser_policy_disable_fxscreenshots.js
@@ -11,19 +11,19 @@ async function checkScreenshots(shouldBe
   }, "Expecting screenshots to be " + shouldBeEnabled);
 }
 
 add_task(async function test_disable_firefox_screenshots() {
   // Dynamically toggling the PREF_DISABLE_FX_SCREENSHOTS is very finicky, because
   // that pref is being watched, and it makes the Firefox Screenshots system add-on
   // to start or stop, causing intermittency.
   //
-  // Firefox Screenshots is disabled by default on tests (in prefs_general.js).
-  // What we do here to test this policy is to enable it on this specific
-  // test folder (through browser.ini) and then we let the policy engine
-  // be responsible for disabling Firefox Screenshots in this case.
+  // Firefox Screenshots is disabled by default on tests (in
+  // testing/profiles/common/user.js). What we do here to test this policy is to enable
+  // it on this specific test folder (through browser.ini) and then we let the policy
+  // engine be responsible for disabling Firefox Screenshots in this case.
 
   is(Services.prefs.getBoolPref(PREF_DISABLE_FX_SCREENSHOTS), true, "Screenshots pref is disabled");
 
   await BrowserTestUtils.withNewTab("data:text/html,Test", async function() {
     await checkScreenshots(false);
   });
 });
--- a/browser/extensions/pocket/test/head.js
+++ b/browser/extensions/pocket/test/head.js
@@ -21,17 +21,17 @@ function promisePocketEnabled() {
 
 function promisePocketDisabled() {
   if (Services.prefs.getPrefType("extensions.pocket.enabled") == Services.prefs.PREF_INVALID ||
       !Services.prefs.getBoolPref("extensions.pocket.enabled")) {
     info("pocket-button already disabled");
     return Promise.resolve(true);
   }
   info("reset pocket enabled pref");
-  // testing/profiles/prefs_general.js uses user_pref to disable pocket, set
+  // testing/profiles/common/user.js uses user_pref to disable pocket, set
   // back to false.
   Services.prefs.setBoolPref("extensions.pocket.enabled", false);
   return BrowserTestUtils.waitForCondition(() => {
     return !PageActions.actionForID("pocket");
   }).then(() => {
     // wait for a full unload of pocket
     return BrowserTestUtils.waitForCondition(() => {
       return !window.hasOwnProperty("pktUI");
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -30,18 +30,16 @@ if os.path.isdir(mozbase):
             sys.path.append(package_path)
 
 import mozcrash
 from mozscreenshot import printstatus, dump_screen
 
 
 # ---------------------------------------------------------------
 
-_DEFAULT_PREFERENCE_FILE = os.path.join(SCRIPT_DIR, 'prefs_general.js')
-
 _DEFAULT_WEB_SERVER = "127.0.0.1"
 _DEFAULT_HTTP_PORT = 8888
 _DEFAULT_SSL_PORT = 4443
 _DEFAULT_WEBSOCKET_PORT = 9988
 
 #expand _DIST_BIN = __XPC_BIN_PATH__
 #expand _IS_WIN32 = len("__WIN32__") != 0
 #expand _IS_MAC = __IS_MAC__ != 0
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -39,17 +39,17 @@ if __name__ == '__main__':
     locations = ServerLocations()
     locations.add_host(host='127.0.0.1',
                        port=PORT,
                        options='primary,privileged')
 
     with TemporaryDirectory() as profilePath:
         # TODO: refactor this into mozprofile
         prefpath = os.path.join(
-            build.topsrcdir, "testing", "profiles", "prefs_general.js")
+            build.topsrcdir, "testing", "profiles", "common", "user.js")
         overridepath = os.path.join(
             build.topsrcdir, "build", "pgo", "prefs_override.js")
 
         prefs = {}
         prefs.update(Preferences.read_prefs(prefpath))
         prefs.update(Preferences.read_prefs(overridepath))
 
         interpolation = {"server": "%s:%d" % httpd.httpd.server_address,
--- a/build/valgrind/mach_commands.py
+++ b/build/valgrind/mach_commands.py
@@ -60,17 +60,17 @@ class MachCommands(MachCommandBase):
 
         # XXX: currently we just use the PGO inputs for Valgrind runs.  This may
         # change in the future.
         httpd = MozHttpd(docroot=os.path.join(build_dir, 'pgo'))
         httpd.start(block=False)
 
         with TemporaryDirectory() as profilePath:
             #TODO: refactor this into mozprofile
-            prefpath = os.path.join(self.topsrcdir, 'testing', 'profiles', 'prefs_general.js')
+            prefpath = os.path.join(self.topsrcdir, 'testing', 'profiles', 'common', 'user.js')
             prefs = {}
             prefs.update(Preferences.read_prefs(prefpath))
             interpolation = { 'server': '%s:%d' % httpd.httpd.server_address,
                               'OOP': 'false'}
             prefs = json.loads(json.dumps(prefs) % interpolation)
             for pref in prefs:
                 prefs[pref] = Preferences.cast(prefs[pref])
 
--- a/taskcluster/ci/source-test/python.yml
+++ b/taskcluster/ci/source-test/python.yml
@@ -67,17 +67,17 @@ mochitest-harness:
             ./mach python-test --subsuite mochitest
     when:
         files-changed:
             - 'testing/mochitest/**'
             - 'testing/mozbase/moztest/moztest/selftest/**'
             - 'testing/mozharness/mozharness/base/log.py'
             - 'testing/mozharness/mozharness/mozilla/structuredlog.py'
             - 'testing/mozharness/mozharness/mozilla/testing/errors.py'
-            - 'testing/profiles/prefs_general.js'
+            - 'testing/profiles/**'
 
 mozbase:
     description: testing/mozbase unit tests
     treeherder:
         symbol: py(mb)
     run:
         mach: python-test --subsuite mozbase
     when:
--- a/testing/mochitest/runjunit.py
+++ b/testing/mochitest/runjunit.py
@@ -94,22 +94,17 @@ class JUnitTestRunner(MochitestDesktop):
             self.options.certPath = os.path.join(build_obj.topsrcdir,
                                                  'build', 'pgo', 'certs')
 
     def build_profile(self):
         """
            Create a local profile with test prefs and proxy definitions and
            push it to the remote device.
         """
-        preferences = [
-            os.path.join(
-                here,
-                'profile_data',
-                'prefs_general.js')]
-
+        preferences = [os.path.join(here, 'profile_data', 'common', 'user.js')]
         prefs = {}
         for path in preferences:
             prefs.update(Preferences.read_prefs(path))
 
         interpolation = {
             "server": "%s:%s" %
             (self.options.webServer, self.options.httpPort)}
 
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1853,22 +1853,17 @@ toolbar#nav-bar {
             options.extraPrefs.append(
                 "mochitest.testRoot=%s" %
                 self.testRootAbs)
 
         # get extensions to install
         extensions = self.getExtensionsToInstall(options)
 
         # preferences
-        preferences = [
-            os.path.join(
-                SCRIPT_DIR,
-                'profile_data',
-                'prefs_general.js')]
-
+        preferences = [os.path.join(SCRIPT_DIR, 'profile_data', 'common', 'user.js')]
         prefs = {}
         for path in preferences:
             prefs.update(Preferences.read_prefs(path))
 
         prefs.update(self.extraPrefs(options.extraPrefs))
 
         # Bug 1262954: For windows XP + e10s disable acceleration
         if platform.system() in ("Windows", "Microsoft") and \
new file mode 100644
--- /dev/null
+++ b/testing/profiles/common/extensions/README.txt
@@ -0,0 +1,2 @@
+Dropping extensions here will get them installed in all test harnesses
+that make use of this profile.
rename from testing/profiles/prefs_general.js
rename to testing/profiles/common/user.js
--- a/testing/profiles/moz.build
+++ b/testing/profiles/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-mochitest_profile_files = [
-    'prefs_general.js',
+profiles = [
+    'common/*',
 ]
 
-TEST_HARNESS_FILES.testing.mochitest.profile_data += mochitest_profile_files
-TEST_HARNESS_FILES['web-platform'].prefs += mochitest_profile_files
+TEST_HARNESS_FILES.testing.mochitest.profile_data += profiles
+TEST_HARNESS_FILES['web-platform'].prefs += ['common/user.js']
 
 with Files("**"):
     BUG_COMPONENT = ("Testing", "Mochitest")
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -238,17 +238,17 @@ ifdef STRIP_COMPILED_TESTS
 else
 	cp -RL $(DIST)/bin/jsapi-tests$(BIN_SUFFIX) $(PKG_STAGE)/cppunittest
 endif
 
 stage-steeplechase: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/steeplechase/
 	cp -RL $(DEPTH)/_tests/steeplechase $(PKG_STAGE)/steeplechase/tests
 	cp -RL $(DIST)/xpi-stage/specialpowers $(PKG_STAGE)/steeplechase
-	cp -RL $(topsrcdir)/testing/profiles/prefs_general.js $(PKG_STAGE)/steeplechase
+	cp -RL $(topsrcdir)/testing/profiles/common/user.js $(PKG_STAGE)/steeplechase/prefs_general.js
 
 TEST_EXTENSIONS := \
     specialpowers@mozilla.org.xpi \
 	$(NULL)
 
 stage-extensions: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/extensions/
 	@$(foreach ext,$(TEST_EXTENSIONS), cp -RL $(DIST)/xpi-stage/$(ext) $(PKG_STAGE)/extensions;)
--- a/testing/web-platform/tests/tools/wpt/browser.py
+++ b/testing/web-platform/tests/tools/wpt/browser.py
@@ -200,28 +200,28 @@ class Firefox(Browser):
             if channel == "beta":
                 tag = "FIREFOX_%s_BETA" % version.split(".", 1)[0]
             else:
                 # Always use tip as the tag for nightly; this isn't quite right
                 # but to do better we need the actual build revision, which we
                 # can get if we have an application.ini file
                 tag = "tip"
 
-        return "%s/raw-file/%s/testing/profiles/prefs_general.js" % (repo, tag)
+        return "%s/raw-file/%s/testing/profiles/common/user.js" % (repo, tag)
 
     def install_prefs(self, binary, dest=None):
         version, channel = self.get_version_number(binary)
 
         if dest is None:
             dest = os.pwd
 
-        dest = os.path.join(dest, "profiles")
+        dest = os.path.join(dest, "profiles", "common")
         if not os.path.exists(dest):
             os.makedirs(dest)
-        prefs_file = os.path.join(dest, "prefs_general.js")
+        prefs_file = os.path.join(dest, "user.js")
         cache_file = os.path.join(dest,
                                   "%s-%s.cache" % (version, channel)
                                   if channel != "nightly"
                                   else "nightly.cache")
 
         have_cache = False
         if os.path.exists(cache_file):
             if channel != "nightly":
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -240,17 +240,17 @@ class FirefoxBrowser(Browser):
         self.logger.debug("Starting Firefox")
 
         self.runner.start(debug_args=debug_args, interactive=self.debug_info and self.debug_info.interactive)
         self.logger.debug("Firefox Started")
 
     def load_prefs(self):
         prefs = Preferences()
 
-        prefs_path = os.path.join(self.prefs_root, "prefs_general.js")
+        prefs_path = os.path.join(self.prefs_root, "user.js")
         if os.path.exists(prefs_path):
             prefs.add(Preferences.read_prefs(prefs_path))
         else:
             self.logger.warning("Failed to find base prefs file in %s" % prefs_path)
 
         # Add any custom preferences
         prefs.add(self.extra_prefs, cast=True)