Bug 1434281 - also delete local/cache profile directory from refresh test, r=whimboo
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 02 Aug 2018 18:54:28 +0000
changeset 429909 1a0c506d69a80ee792d73b4090eeb5e755f17bf8
parent 429908 3873025d2fa85ea891919586ebced0873c8997ce
child 429910 b1c100e2b29a8e671678eb537ba69badc249c2fe
child 429967 c1e6a1d2677305cbb9e560b84977fcf10620991c
push id106015
push usernbeleuzu@mozilla.com
push dateThu, 02 Aug 2018 22:36:07 +0000
treeherdermozilla-inbound@055397065a0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1434281
milestone63.0a1
first release with
nightly linux32
1a0c506d69a8 / 63.0a1 / 20180802220056 / files
nightly linux64
1a0c506d69a8 / 63.0a1 / 20180802220056 / files
nightly mac
1a0c506d69a8 / 63.0a1 / 20180802220056 / files
nightly win32
1a0c506d69a8 / 63.0a1 / 20180802220056 / files
nightly win64
1a0c506d69a8 / 63.0a1 / 20180802220056 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1434281 - also delete local/cache profile directory from refresh test, r=whimboo Ensure local profile directory is also deleted in test teardown. Differential Revision: https://phabricator.services.mozilla.com/D2671
browser/components/migration/tests/marionette/test_refresh_firefox.py
--- a/browser/components/migration/tests/marionette/test_refresh_firefox.py
+++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py
@@ -463,16 +463,17 @@ class TestFirefoxRefresh(MarionetteTestC
                                                     *args,
                                                     **kwargs)
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.setUpScriptData()
 
         self.reset_profile_path = None
+        self.reset_profile_local_path = None
         self.desktop_backup_path = None
 
         self.createProfileData()
 
     def tearDown(self):
         # Force yet another restart with a clean profile to disconnect from the
         # profile and environment changes we've made, to leave a more or less
         # blank slate for the next person.
@@ -502,16 +503,22 @@ class TestFirefoxRefresh(MarionetteTestC
         if self.reset_profile_path:
             # Remove ourselves from profiles.ini
             self.runCode("""
               let name = arguments[0];
               let profile = global.profSvc.getProfileByName(name);
               profile.remove(false)
               global.profSvc.flush();
             """, script_args=(self.profileNameToRemove,))
+            # Remove the local profile dir if it's not the same as the profile dir:
+            different_path = self.reset_profile_local_path != self.reset_profile_path
+            if self.reset_profile_local_path and different_path:
+                shutil.rmtree(self.reset_profile_local_path,
+                              ignore_errors=False, onerror=handleRemoveReadonly)
+
             # And delete all the files.
             shutil.rmtree(self.reset_profile_path,
                           ignore_errors=False, onerror=handleRemoveReadonly)
 
     def doReset(self):
         profileName = "marionette-test-profile-" + str(int(time.time() * 1000))
         self.profileNameToRemove = profileName
         self.runCode("""
@@ -538,19 +545,20 @@ class TestFirefoxRefresh(MarionetteTestC
         profileLeafName = os.path.basename(os.path.normpath(
             self.marionette.instance.profile.profile))
 
         # Now restart the browser to get it reset:
         self.marionette.restart(clean=False, in_app=True)
         self.setUpScriptData()
 
         # Determine the new profile path (we'll need to remove it when we're done)
-        self.reset_profile_path = self.runCode("""
+        [self.reset_profile_path, self.reset_profile_local_path] = self.runCode("""
           let profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
-          return profD.path;
+          let localD = Services.dirsvc.get("ProfLD", Ci.nsIFile);
+          return [profD.path, localD.path];
         """)
 
         # Determine the backup path
         self.desktop_backup_path = self.runCode("""
           let container;
           try {
             container = Services.dirsvc.get("Desk", Ci.nsIFile);
           } catch (ex) {