Bug 1252995 - recordTestCoverage modification. r=chmanchester
authorGreg Mierzwinski <gmierz2@outlook.com>
Fri, 11 Mar 2016 19:21:36 -0500
changeset 331162 c155349cb40312927dd7c1f9756598e28ac949d2
parent 331161 1602320ae20876e40c82b6d936dae74cf28ab02b
child 331163 b4b843abf463252b8177c12268b19c9ade761224
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1252995
milestone48.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 1252995 - recordTestCoverage modification. r=chmanchester This is a modification to recordTestCoverage. It now gathers methods and the lines each span, uncovered lines, and now also places a version control block at the beginning of every artifact. MozReview-Commit-ID: LbpnDqheYpy
testing/modules/CoverageUtils.jsm
--- a/testing/modules/CoverageUtils.jsm
+++ b/testing/modules/CoverageUtils.jsm
@@ -160,26 +160,43 @@ CoverageCollector.prototype._getMethodNa
 /**
  * Records lines covered since the last time coverage was recorded,
  * associating them with the given test name. The result is written
  * to a json file in a specified directory.
  */
 CoverageCollector.prototype.recordTestCoverage = function (testName) {
   dump("Collecting coverage for: " + testName + "\n");
   let rawLines = this._getLinesCovered(testName);
+  let methods = this._getMethodNames();
+  let uncoveredLines = this._getUncoveredLines();
   let result = [];
+  let versionControlBlock = {version: 1.0};
+  result.push(versionControlBlock);
+
   for (let scriptName in rawLines) {
     let rec = {
       testUrl: testName,
       sourceFile: scriptName,
-      covered: []
+      methods: {},
+      covered: [],
+      uncovered: []
     };
+
+    for (let methodName in methods[scriptName]){
+      rec.methods[methodName] = methods[scriptName][methodName];
+    }
+
     for (let line of rawLines[scriptName]) {
       rec.covered.push(line);
     }
+
+    for (let line of uncoveredLines[scriptName]){
+      rec.uncovered.push(line);
+    }
+
     result.push(rec);
   }
   let arr = this._encoder.encode(JSON.stringify(result, null, 2));
   let path = this._prefix + '/' + 'jscov_' + Date.now() + '.json';
   dump("Writing coverage to: " + path + "\n");
   return OS.File.writeAtomic(path, arr, {tmpPath: path + '.tmp'});
 }