Bug 1401207 - Refactor DAMP to more easily filter subtests. r=bgrins

MozReview-Commit-ID: GXpujntQ5F2

--HG--
extra : rebase_source : 04e178326d62f9cecf416829a1246968592b98e9
This commit is contained in:
Alexandre Poirot 2017-10-17 08:59:17 -07:00
Родитель 92f74a28ce
Коммит 9107b9f013
2 изменённых файлов: 78 добавлений и 60 удалений

Просмотреть файл

@ -10,30 +10,52 @@ var defaultConfig = {
repeat: 1,
rest: 100,
subtests: {
webconsoleOpen: true,
inspectorOpen: true,
debuggerOpen: true,
styleEditorOpen: true,
performanceOpen: true,
netmonitorOpen: true,
saveAndReadHeapSnapshot: true,
consoleBulkLogging: true,
consoleStreamLogging: true,
consoleObjectExpansion: true,
"cold.inspector": true,
"simple.webconsole": true,
"simple.inspector": true,
"simple.debugger": true,
"simple.styleeditor": true,
"simple.performance": true,
"simple.netmonitor": true,
"simple.saveAndReadHeapSnapshot": true,
"complicated.webconsole": true,
"complicated.inspector": true,
"complicated.debugger": true,
"complicated.styleeditor": true,
"complicated.performance": true,
"complicated.netmonitor": true,
"complicated.saveAndReadHeapSnapshot": true,
"console.bulklog": true,
"console.streamlog": true,
"console.objectexpand": true,
}
};
var testsInfo = {
webconsoleOpen: "Measure open/close toolbox on webconsole panel",
inspectorOpen: "Measure open/close toolbox on inspector panel",
debuggerOpen: "Measure open/close toolbox on debugger panel",
styleEditorOpen: "Measure open/close toolbox on style editor panel",
performanceOpen: "Measure open/close toolbox on performance panel",
netmonitorOpen: "Measure open/close toolbox on network monitor panel",
saveAndReadHeapSnapshot: "Measure open/close toolbox on memory panel and save/read heap snapshot",
consoleBulkLogging: "Measure time for a bunch of sync console.log statements to appear",
consoleStreamLogging: "Measure rAF on page during a stream of console.log statements",
consoleObjectExpansion: "Measure time to expand a large object and close the console",
"cold.inspector": "Measure first open toolbox on inspector panel",
"simple.webconsole": "Measure open/close toolbox on webconsole panel against simple document",
"simple.inspector": "Measure open/close toolbox on inspector panel against simple document",
"simple.debugger": "Measure open/close toolbox on debugger panel against simple document",
"simple.styleeditor": "Measure open/close toolbox on style editor panel against simple document",
"simple.performance": "Measure open/close toolbox on performance panel against simple document",
"simple.netmonitor": "Measure open/close toolbox on network monitor panel against simple document",
"simple.saveAndReadHeapSnapshot": "Measure open/close toolbox on memory panel and save/read heap snapshot against simple document",
"complicated.webconsole": "Measure open/close toolbox on webconsole panel against complicated document",
"complicated.inspector": "Measure open/close toolbox on inspector panel against complicated document",
"complicated.debugger": "Measure open/close toolbox on debugger panel against complicated document",
"complicated.styleeditor": "Measure open/close toolbox on style editor panel against complicated document",
"complicated.performance": "Measure open/close toolbox on performance panel against complicated document",
"complicated.netmonitor": "Measure open/close toolbox on network monitor panel against complicated document",
"complicated.saveAndReadHeapSnapshot": "Measure open/close toolbox on memory panel and save/read heap snapshot against complicated document",
"console.bulklog": "Measure time for a bunch of sync console.log statements to appear",
"console.streamlog": "Measure rAF on page during a stream of console.log statements",
"console.objectexpand": "Measure time to expand a large object and close the console",
};
function updateConfig() {

Просмотреть файл

@ -380,8 +380,8 @@ Damp.prototype = {
},
_getToolLoadingTests(url, label, { expectedMessages, expectedSources }) {
let subtests = {
inspectorOpen: Task.async(function* () {
let tests = {
inspector: Task.async(function* () {
yield this.testSetup(url);
let toolbox = yield this.openToolboxAndLog(label + ".inspector", "inspector");
let onReload = async function() {
@ -396,7 +396,7 @@ Damp.prototype = {
yield this.testTeardown();
}),
webconsoleOpen: Task.async(function* () {
webconsole: Task.async(function* () {
yield this.testSetup(url);
let toolbox = yield this.openToolboxAndLog(label + ".webconsole", "webconsole");
let onReload = async function() {
@ -417,7 +417,7 @@ Damp.prototype = {
yield this.testTeardown();
}),
debuggerOpen: Task.async(function* () {
debugger: Task.async(function* () {
yield this.testSetup(url);
let onLoad = async function(toolbox, dbg) {
await new Promise(done => {
@ -453,7 +453,7 @@ Damp.prototype = {
yield this.testTeardown();
}),
styleEditorOpen: Task.async(function* () {
styleeditor: Task.async(function* () {
yield this.testSetup(url);
yield this.openToolboxAndLog(label + ".styleeditor", "styleeditor");
yield this.reloadPageAndLog(label + ".styleeditor");
@ -461,7 +461,7 @@ Damp.prototype = {
yield this.testTeardown();
}),
performanceOpen: Task.async(function* () {
performance: Task.async(function* () {
yield this.testSetup(url);
yield this.openToolboxAndLog(label + ".performance", "performance");
yield this.reloadPageAndLog(label + ".performance");
@ -469,7 +469,7 @@ Damp.prototype = {
yield this.testTeardown();
}),
netmonitorOpen: Task.async(function* () {
netmonitor: Task.async(function* () {
yield this.testSetup(url);
const toolbox = yield this.openToolboxAndLog(label + ".netmonitor", "netmonitor");
const requestsDone = this.waitForNetworkRequests(label + ".netmonitor", toolbox);
@ -490,21 +490,12 @@ Damp.prototype = {
yield this.testTeardown();
}),
};
// Construct the sequence array: config.repeat times config.subtests
let config = this._config;
let sequenceArray = [];
for (var i in config.subtests) {
for (var r = 0; r < config.repeat; r++) {
if (!config.subtests[i] || !subtests[config.subtests[i]]) {
continue;
}
sequenceArray.push(subtests[config.subtests[i]]);
}
// Prefix all tests with the page type (simple or complicated)
for(let name in tests) {
tests[label + "." + name] = tests[name];
delete tests[name];
}
return sequenceArray;
return tests;
},
testSetup: Task.async(function* (url) {
@ -661,36 +652,41 @@ Damp.prototype = {
TalosParentProfiler.resume("DAMP - start");
let tests = [];
if (config.subtests.indexOf("inspectorOpen") > -1) {
// Run cold test only once
let topWindow = getMostRecentBrowserWindow();
if (!topWindow.coldRunDAMP) {
topWindow.coldRunDAMP = true;
tests = tests.concat(this._coldInspectorOpen);
}
let tests = {};
// Run cold test only once
let topWindow = getMostRecentBrowserWindow();
if (!topWindow.coldRunDAMP) {
topWindow.coldRunDAMP = true;
tests["cold.inspector"] = this._coldInspectorOpen;
}
tests = tests.concat(this._getToolLoadingTests(SIMPLE_URL, "simple", {
Object.assign(tests, this._getToolLoadingTests(SIMPLE_URL, "simple", {
expectedMessages: 1,
expectedSources: 1,
}));
tests = tests.concat(this._getToolLoadingTests(COMPLICATED_URL, "complicated", {
Object.assign(tests, this._getToolLoadingTests(COMPLICATED_URL, "complicated", {
expectedMessages: 7,
expectedSources: 14,
}));
if (config.subtests.indexOf("consoleBulkLogging") > -1) {
tests = tests.concat(this._consoleBulkLoggingTest);
}
if (config.subtests.indexOf("consoleStreamLogging") > -1) {
tests = tests.concat(this._consoleStreamLoggingTest);
}
if (config.subtests.indexOf("consoleObjectExpansion") > -1) {
tests = tests.concat(this._consoleObjectExpansionTest);
tests["console.bulklog"] = this._consoleBulkLoggingTest;
tests["console.streamlog"] = this._consoleStreamLoggingTest;
tests["console.objectexpand"] = this._consoleObjectExpansionTest;
// Construct the sequence array while filtering tests
let sequenceArray = [];
for (var i in config.subtests) {
for (var r = 0; r < config.repeat; r++) {
if (!config.subtests[i] || !tests[config.subtests[i]]) {
continue;
}
sequenceArray.push(tests[config.subtests[i]]);
}
}
this._doSequence(tests, this._doneInternal);
this._doSequence(sequenceArray, this._doneInternal);
}
}