Bug 1189901: part 4: scroll: report custom test name. r=jmaher
authorAvi Halachmi <avihpit@yahoo.com>
Thu, 29 Sep 2016 21:00:22 +0300
changeset 315864 2b747bcd819e4379a7f4036d271a398b9236802e
parent 315863 a72a4afe756ea5664d2391bfa6ec0882e91ffc89
child 315865 1a294b6d4847c3e9ccd427fc05e4a707c06ec93e
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1189901
milestone52.0a1
Bug 1189901: part 4: scroll: report custom test name. r=jmaher
testing/talos/talos/pageloader/chrome/tscroll.js
--- a/testing/talos/talos/pageloader/chrome/tscroll.js
+++ b/testing/talos/talos/pageloader/chrome/tscroll.js
@@ -7,16 +7,30 @@ function testScroll(target, stepSize, op
   var win;
   if (target == "content") {
     target = content.wrappedJSObject;
     win = content;
   } else {
     win = window;
   }
 
+  var result = {
+    names: [],
+    values: [],
+  };
+  // We report multiple results, so we base the name on the path.
+  // Everything after '/tp5n/' if exists (for tp5o_scroll), or the file name at
+  // the path if non-empty (e.g. with tscrollx), or the last dir otherwise (e.g.
+  // 'mydir' for 'http://my.domain/dir1/mydir/').
+  var href = win.location.href;
+  var testBaseName = href.split("/tp5n/")[1]
+                  || href.split("/").pop()
+                  || href.split("/").splice(-2, 1)[0]
+                  || "REALLY_WEIRD_URI";
+
   var report;
   /**
    * Sets up the value of 'report' as a function for reporting the test result[s].
    * Chooses between the "usual" tpRecordTime which the pageloader addon injects
    * to pages, or a custom function in case we're a framescript which pageloader
    * added to the tested page, or a debug tpRecordTime from talos-debug.js if
    * running in a plain browser.
    *
@@ -131,17 +145,19 @@ function testScroll(target, stepSize, op
             win.talosDebug.displayData = true; // In a browser: also display all data points.
 
           // For analysis (otherwise, it's too many data points for talos):
           var sum = 0;
           for (var i = 0; i < durations.length; i++)
             sum += Number(durations[i]);
 
           // Report average interval or (failsafe) 0 if no intervls were recorded
-          resolve(durations.length ? sum / durations.length : 0);
+          result.values.push(durations.length ? sum / durations.length : 0);
+          result.names.push(testBaseName);
+          resolve();
           return;
         }
 
         lastScrollPos = getPos();
         rAF(tick);
       }
 
       if (typeof(Profiler) !== "undefined") {
@@ -151,18 +167,18 @@ function testScroll(target, stepSize, op
     });
   }
 
   P_setupReportFn()
   .then(FP_wait(260))
   .then(gotoTop)
   .then(P_rAF)
   .then(P_syncScrollTest)
-  .then(function(result) { // function since 'report' might not be ready when invoking 'then'
-    report(result);
+  .then(function() {
+    report(result.values.join(","), 0, result.names.join(","));
   });
 }
 
 // This code below here is unique to tscroll.js inside of pageloader
 try {
   function handleMessageFromChrome(message) {
     var payload = message.data.details;
     testScroll(payload.target, payload.stepSize, 'PageLoader:RecordTime', payload.opt_numSteps);