Bug 708498 - TPS logging improvements; r=rnewman
authorGregory Szorc <gps@mozilla.com>
Wed, 07 Dec 2011 17:57:12 -0800
changeset 82981 ea538df967d5c327efc3b032c3b591f96f445c06
parent 82980 6f6e4ac35d350747b9272d5496e691ebf7746e29
child 82982 1e14d5a1c5e7e708f24d45af565fc8fab1e0640a
push id21715
push usergszorc@mozilla.com
push dateMon, 19 Dec 2011 20:28:27 +0000
treeherdermozilla-central@e2194521b6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs708498
milestone11.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 708498 - TPS logging improvements; r=rnewman
services/sync/tps/extensions/tps/modules/logger.jsm
services/sync/tps/extensions/tps/modules/tps.jsm
--- a/services/sync/tps/extensions/tps/modules/logger.jsm
+++ b/services/sync/tps/extensions/tps/modules/logger.jsm
@@ -96,24 +96,29 @@ var Logger =
     if (this._converter != null) {
       this._converter.close();
       this._converter = null;
       this._foStream = null;
     }
   },
 
   AssertTrue: function(bool, msg, showPotentialError) {
-    if (!bool) {
-      let message = msg;
-      if (showPotentialError && this._potentialError) {
-        message += "; " + this._potentialError;
-        this._potentialError = null;
-      }
-      throw("ASSERTION FAILED! " + message);
+    if (bool) {
+      return;
     }
+
+    if (showPotentialError && this._potentialError) {
+      msg += "; " + this._potentialError;
+      this._potentialError = null;
+    }
+    throw("ASSERTION FAILED! " + msg);
+  },
+
+  AssertFalse: function(bool, msg, showPotentialError) {
+    return this.AssertTrue(!bool, msg, showPotentialError);
   },
 
   AssertEqual: function(val1, val2, msg) {
     if (val1 != val2)
       throw("ASSERTION FAILED! " + msg + "; expected " +
             JSON.stringify(val2) + ", got " + JSON.stringify(val1));
   },
 
@@ -121,17 +126,17 @@ var Logger =
     dump(msg + "\n");
     if (withoutPrefix) {
       this.write(msg + "\n");
     }
     else {
       var now = new Date()
       this.write(now.getFullYear() + "-" + (now.getMonth() < 9 ? '0' : '') +
           (now.getMonth() + 1) + "-" +
-          (now.getDate() < 9 ? '0' : '') + (now.getDate() + 1) + " " +
+          (now.getDate() < 10 ? '0' : '') + (now.getDate()) + " " +
           (now.getHours() < 10 ? '0' : '') + now.getHours() + ":" +
           (now.getMinutes() < 10 ? '0' : '') + now.getMinutes() + ":" +
           (now.getSeconds() < 10 ? '0' : '') + now.getSeconds() + " " +
           msg + "\n");
     }
   },
 
   clearPotentialError: function() {
--- a/services/sync/tps/extensions/tps/modules/tps.jsm
+++ b/services/sync/tps/extensions/tps/modules/tps.jsm
@@ -143,17 +143,17 @@ var TPS =
           }
           break;
         case "sessionstore-windows-restored":
           Utils.nextTick(this.RunNextTestAction, this);
           break;
       }
     }
     catch(e) {
-      this.DumpError("Exception caught: " + e);
+      this.DumpError("Exception caught: " + Utils.exceptionStr(e));
       return;
     }
   },
 
   StartAsyncOperation: function TPS__StartAsyncOperation() {
     this._operations_pending++;
   },
 
@@ -474,17 +474,17 @@ var TPS =
 
       // if we're in an async operation, don't continue on to the next action
       if (this._operations_pending)
         return;
 
       this._currentAction++;
     }
     catch(e) {
-      this.DumpError("Exception caught: " + e);
+      this.DumpError("Exception caught: " + Utils.exceptionStr(e));
       return;
     }
     this.RunNextTestAction();
   },
 
   RunTestPhase: function (file, phase, logpath) {
     try {
       Logger.init(logpath);
@@ -533,17 +533,17 @@ var TPS =
       if (this.config.account['serverURL']) {
         prefs.setCharPref('tps.account.serverURL', this.config.account.serverURL);
       }
 
       // start processing the test actions
       this._currentAction = 0;
     }
     catch(e) {
-      this.DumpError("Exception caught: " + e);
+      this.DumpError("Exception caught: " + Utils.exceptionStr(e));
       return;
     }
   },
 
   Phase: function Test__Phase(phasename, fnlist) {
     this._phaselist[phasename] = fnlist;
   },