Bug 1378209 - Add INFO log lines for how Marionette got started. r=automatedtester, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Wed, 05 Jul 2017 10:33:23 +0200
changeset 414224 b3fbfc8eb689d1d8e3d3166f827264bb700775c4
parent 414223 3d1277c0c560998260a60777541ad4e396800d58
child 414225 06dc3565c7c0497c71afa6d02db8f75838f54a4d
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1378209
milestone55.0
Bug 1378209 - Add INFO log lines for how Marionette got started. r=automatedtester, a=test-only It is helpful to let the user know how Marionette get started. So INFO log lines have to be added for the command line argument and the environment variable. This is especially helpful to get in case of missing observer notifications, under which the server socket is not getting created, and the client just hangs. MozReview-Commit-ID: 4TEF33CDJKP
testing/marionette/components/marionette.js
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -111,29 +111,33 @@ const prefs = {
           Preferences.set(prefName, prefs[prefName]);
         }
       }
     }
   },
 };
 
 function MarionetteComponent() {
-  this.enabled = env.exists(ENV_ENABLED);
   this.running = false;
   this.server = null;
 
   // holds reference to ChromeWindow
   // used to run GFX sanity tests on Windows
   this.gfxWindow = null;
 
   // indicates that all pending window checks have been completed
   // and that we are ready to start the Marionette server
   this.finalUIStartup = false;
 
   this.logger = this.setupLogger(prefs.logLevel);
+
+  this.enabled = env.exists(ENV_ENABLED);
+  if (this.enabled) {
+    this.logger.info(`Enabled via ${ENV_ENABLED}`);
+  }
 }
 
 MarionetteComponent.prototype = {
   classDescription: "Marionette component",
   classID: MARIONETTE_CID,
   contractID: MARIONETTE_CONTRACT_ID,
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsICommandLineHandler,
@@ -152,18 +156,19 @@ MarionetteComponent.prototype.onSocketAc
 
 MarionetteComponent.prototype.onStopListening = function (socket, status) {
   this.logger.info(`onStopListening for Marionette dummy socket, code ${status}`);
   socket.close();
 };
 
 // Handle -marionette flag
 MarionetteComponent.prototype.handle = function (cmdLine) {
-  if (cmdLine.handleFlag("marionette", false)) {
+  if (!this.enabled && cmdLine.handleFlag("marionette", false)) {
     this.enabled = true;
+    this.logger.info("Enabled via --marionette");
   }
 };
 
 MarionetteComponent.prototype.observe = function (subject, topic, data) {
   switch (topic) {
     case "command-line-startup":
       Services.obs.removeObserver(this, topic);
       this.handle(subject);