- failure correlation with tests
authorAndrew Sutherland <asutherland@asutherland.org>
Sat, 07 Nov 2009 17:58:48 -0800
changeset 15 82312c9501ceeff6ddc4cb36b849e05b7aab97bf
parent 14 c335bd85ec00138dadfd4c374ea1946f8d27fba9
child 16 920fab00ffead1935f1e07c6da94e8db12e22f56
push id4
push userbugmail@asutherland.org
push dateSun, 08 Nov 2009 01:58:50 +0000
- failure correlation with tests - highlight the current small multiple bucket (pooorly) - actually cause redrawing to quiesce like originally planned - redraw small multiple bucket immediately when the selection changes - use JSON instead of nsIJSON.
chrome/content/logui.js
chrome/content/logvis.js
chrome/content/processors.js
chrome/modules/gobbler.js
--- a/chrome/content/logui.js
+++ b/chrome/content/logui.js
@@ -26,16 +26,17 @@ let LogUI = {
   },
 
   /**
    * Select a bucket and make it current.
    *
    * @param bucketAggr A bucket aggregation as provided by LogAggr.
    */
   selectBucket: function LogUI_selectBucket(bucketAggr) {
+    this.selectedBucket = bucketAggr;
     this._notifyListeners("onBucketSelected",
                           [this.selectedLogFile, bucketAggr]);
     $("#data-tabs").tabs("select", "bucket-contents");
   },
 
   showDetail: function LogUI_showDetail(obj, clickOrigin) {
     this._notifyListeners("onShowDetail", arguments);
     $("#data-tabs").tabs("select", "detail-view");
@@ -219,16 +220,19 @@ let TestList = {
   _init: function TestList__init() {
     LogManager.registerListener("onReset", this.onReset, this);
     LogUI.registerListener("onLogFileSelected", this.onLogFileSelected, this);
 
     LogProcessor.registerListener("test", "new",
                                   this.onNewTest, this);
     LogProcessor.registerListener("subtest", "new",
                                   this.onNewTest, this);
+
+    LogProcessor.registerListener("failure", "new",
+                                  this.onFailure, this);
   },
 
   selectedLogFile: null,
 
   onReset: function TestFilesList_onReset() {
     let root = document.getElementById("test-list");
     while (root.lastChild)
       root.removeChild(root.lastChild);
@@ -288,10 +292,17 @@ let TestList = {
     listRoot.appendChild(testNode);
 
     if (test.subtests.length) {
       for each (let [, subtest] in Iterator(test.subtests)) {
         this.onNewTest(logFile, test, subtest);
       }
     }
   },
+
+  onFailure: function TestList_onFailure(context, failure) {
+    if (context.type == "test") {
+      let testNode = document.getElementById("test-" + context.id);
+      testNode.setAttribute("class", "clicky failure");
+    }
+  },
 };
 TestList._init();
--- a/chrome/content/logvis.js
+++ b/chrome/content/logvis.js
@@ -103,31 +103,38 @@ let LoggerHierarchyVisier = {
 };
 LoggerHierarchyVisier._init();
 
 
 
 let DateBucketVis = {
   _init: function DateBucketVis__init() {
     LogUI.registerListener("onLogFileSelected", this._onLogFileSelected, this);
+    LogUI.registerListener("onBucketSelected", this._onBucketSelected, this);
 
     LogUI.registerListener("onTick", this.updateVis, this);
   },
 
   selectedLogFile: null,
   logAggr: null,
-  _onLogFileSelected: function LoggerHierarchyVisier__onLogFileSelected(
+  _onLogFileSelected: function DateBucketVis__onLogFileSelected(
                                  logFile) {
     this.logFile = logFile;
     if (this._cellVis)
       this._cellVis.data(logFile.aggr.buckets);
     this.lastVisedGeneration = -1;
     this.updateVis();
   },
 
+  _onBucketSelected: function DateBucketVis__onBucketSelected(
+                                logFile, bucketAggr) {
+    if (this._vis)
+      this._vis.render();
+  },
+
   WIDTH: 615,
   HEIGHT: 369,
   CELL_WIDTH: 41,
   CELL_HEIGHT: 41,
   _vis: null,
   _makeVis: function DateBucketVis__makeVis() {
     let vis = this._vis = new pv.Panel()
       .canvas("date-bucket-vis")
@@ -156,16 +163,18 @@ let DateBucketVis = {
                               Math.min(1.0, count / 10),
                               0.8, 1);
     };
 
     let cell = this._cellVis = vis.add(pv.Panel)
       .data(this.logFile.aggr.buckets)
       .top(function() Math.floor(this.index / xCount) * CELL_HEIGHT)
       .left(function() (this.index % xCount) * CELL_WIDTH)
+      .lineWidth(function(d) (d == LogUI.selectedBucket) ? 1 : 0)
+      .strokeStyle("yellow")
       .height(CELL_HEIGHT - 1)
       .width(CELL_WIDTH - 1)
       .event("click", function(d) LogUI.selectBucket(d));
     this._mapvis = cell.add(pv.Bar)
       .extend(this._treemap)
       .fillStyle(function(n) colorize(this, n));
 
   },
@@ -180,12 +189,13 @@ let DateBucketVis = {
       this._makeVis();
     else {
       this._treemap = pv.Layout.treemap(LoggerHierarchyVisier.loggerTree)
         .round(true);
       this._mapvis.extend(this._treemap);
     }
 
     this._vis.render();
+    this.lastVisedGeneration = this.logFile.aggr.generation;
   }
 };
 DateBucketVis._init();
 
--- a/chrome/content/processors.js
+++ b/chrome/content/processors.js
@@ -17,16 +17,17 @@ let TypedContextProcessors = {
   test: {
     makeContext: function tcp_test_makeContext(logFile, parentContext,
                                                aggr, bucketAggr, msg, msgObj) {
       if (!("tests" in aggr))
         aggr.tests = [];
 
       let test = {
         id: msgObj._id,
+        type: "test",
         name: msgObj.name,
         parameter: msgObj.parameter,
         firstSeenInBucket: bucketAggr,
         subtests: [],
       };
 
       if (parentContext) {
         parentContext.subtests.push(test);
@@ -49,11 +50,13 @@ let TypedObjectProcessors = {
       if (aggr.failures)
         aggr.failures++;
       else
         aggr.failures = 1;
       if (bucketAggr.failures)
         bucketAggr.failures++;
       else
         bucketAggr.failures = 1;
+
+      LogProcessor.notify("failure", "new", [context, msgObj]);
     }
   }
 };
--- a/chrome/modules/gobbler.js
+++ b/chrome/modules/gobbler.js
@@ -181,27 +181,26 @@ GobblerConnection.prototype = {
  */
 function LogGobbler(aLogEventListener) {
   Gobbler.call(this);
   this.logEventListener = aLogEventListener;
 }
 LogGobbler.prototype = {
   __proto__: Gobbler.prototype,
   connectionClass: LogGobblerConnection,
-  _json: Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON),
 };
 
 function LogGobblerConnection() {
   GobblerConnection.apply(this, arguments);
   this.listener = this._gobbler.logEventListener;
   this.handle = this.listener.onNewConnection();
 }
 LogGobblerConnection.prototype = {
   __proto__: GobblerConnection.prototype,
   processLine: function LogGobblerConnection_processLine(aLine) {
-    let message = this._gobbler._json.decode(aLine);
+    let message = JSON.parse(aLine);
     this.listener.onLogMessage(this.handle, message);
   },
   close: function LogGobblerConnection_close() {
     this.__proto__.__proto__.close.call(this);
     this.listener.onClosedConnection(this.handle);
   }
 };