Backed out changeset 101932a675a4 (bug 1174766) for winXP failures
authorChris Manchester <cmanchester@mozilla.com>
Sat, 20 Jun 2015 15:27:11 -0700
changeset 280681 8a25cd69c4aef0e73390ea704b0752cae5a81b78
parent 280680 ed293fc9596caa5d45186a712dd8b25daf433e68
child 280682 2f18c8a4deb4dca6fc13ea01941f5e292cbfb456
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1174766
milestone41.0a1
backs out101932a675a429995f871bec388013dd7969dad5
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
Backed out changeset 101932a675a4 (bug 1174766) for winXP failures
testing/marionette/driver/marionette_driver/geckoinstance.py
--- a/testing/marionette/driver/marionette_driver/geckoinstance.py
+++ b/testing/marionette/driver/marionette_driver/geckoinstance.py
@@ -45,57 +45,18 @@ class GeckoInstance(object):
             self.profile_path = profile
         self.prefs = prefs
         self.required_prefs = deepcopy(GeckoInstance.required_prefs)
         if prefs:
             self.required_prefs.update(prefs)
         self.app_args = app_args or []
         self.runner = None
         self.symbols_path = symbols_path
-
-        if gecko_log != '-':
-            if gecko_log is None:
-                gecko_log = 'gecko.log'
-            elif os.path.isdir(gecko_log):
-                fname = 'gecko-%d.log' % time.time()
-                gecko_log = os.path.join(gecko_log, fname)
-
-            gecko_log = os.path.realpath(gecko_log)
-
         self.gecko_log = gecko_log
 
-        # We only remove stale log files when starting our instance for the
-        # first time so we end up appending our output after a restart.
-        self.purge_logfile()
-
-    def purge_logfile(self):
-        if os.access(self.gecko_log, os.F_OK):
-            if platform.system() is 'Windows':
-                # NOTE: windows has a weird filesystem where it happily 'closes'
-                # the file, but complains if you try to delete it. You get a
-                # 'file still in use' error. Sometimes you can wait a bit and
-                # a retry will succeed.
-                # If all retries fail, we'll just continue without removing
-                # the file. In this case, if we are restarting the instance,
-                # then the new logs just get appended to the old file.
-                tries = 0
-                while tries < 10:
-                    try:
-                        os.remove(self.gecko_log)
-                        break
-                    except WindowsError as e:
-                        if e.errno == errno.EACCES:
-                            tries += 1
-                            time.sleep(0.5)
-                        else:
-                            raise e
-            else:
-                os.remove(self.gecko_log)
-
-
     def start(self):
         profile_args = {"preferences": deepcopy(self.required_prefs)}
         profile_args["preferences"]["marionette.defaultPrefs.port"] = self.marionette_port
         if self.prefs:
             profile_args["preferences"].update(self.prefs)
         if '-jsdebugger' in self.app_args:
             profile_args["preferences"].update({
                 "devtools.browsertoolbox.panel": "jsdebugger",
@@ -114,16 +75,46 @@ class GeckoInstance(object):
 
         process_args = {
             'processOutputLine': [NullOutput()],
         }
 
         if self.gecko_log == '-':
             process_args['stream'] = sys.stdout
         else:
+            if self.gecko_log is None:
+                self.gecko_log = 'gecko.log'
+            elif os.path.isdir(self.gecko_log):
+                fname = "gecko-%d.log" % time.time()
+                self.gecko_log = os.path.join(self.gecko_log, fname)
+
+            self.gecko_log = os.path.realpath(self.gecko_log)
+            if os.access(self.gecko_log, os.F_OK):
+                if platform.system() is 'Windows':
+                    # NOTE: windows has a weird filesystem where it happily 'closes'
+                    # the file, but complains if you try to delete it. You get a
+                    # 'file still in use' error. Sometimes you can wait a bit and
+                    # a retry will succeed.
+                    # If all retries fail, we'll just continue without removing
+                    # the file. In this case, if we are restarting the instance,
+                    # then the new logs just get appended to the old file.
+                    tries = 0
+                    while tries < 10:
+                        try:
+                            os.remove(self.gecko_log)
+                            break
+                        except WindowsError as e:
+                            if e.errno == errno.EACCES:
+                                tries += 1
+                                time.sleep(0.5)
+                            else:
+                                raise e
+                else:
+                    os.remove(self.gecko_log)
+
             process_args['logfile'] = self.gecko_log
 
         env = os.environ.copy()
 
         # environment variables needed for crashreporting
         # https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
         env.update({ 'MOZ_CRASHREPORTER': '1',
                      'MOZ_CRASHREPORTER_NO_REPORT': '1', })