Bug 1687784 - Profiler markers from mochitests and xpcshell tests should use the Test category, r=mconley.

Differential Revision: https://phabricator.services.mozilla.com/D102466
This commit is contained in:
Florian Quèze 2021-01-20 21:04:00 +00:00
Родитель 8ddda49f11
Коммит 70b524ecf0
5 изменённых файлов: 35 добавлений и 27 удалений

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

@ -137,8 +137,8 @@
if (result.info) {
if (result.msg) {
ChromeUtils.addProfilerMarker("browser-test", undefined,
"TEST-INFO " + result.msg);
ChromeUtils.addProfilerMarker("TEST-INFO", {category: "Test"},
result.msg);
this.dumper.structuredLogger.info(result.msg);
}
return;
@ -149,18 +149,18 @@
result.status,
result.expected,
result.msg);
let markerText = "TEST-";
let markerName = "TEST-";
if (result.pass) {
markerText += result.todo ? "KNOWN-FAIL" : "PASS";
markerName += result.todo ? "KNOWN-FAIL" : "PASS";
}
else {
markerText += "UNEXPECTED-" + result.status;
markerName += "UNEXPECTED-" + result.status;
}
markerText += " " + result.name;
let markerText = result.name;
if (result.msg) {
markerText += " - " + result.msg;
}
ChromeUtils.addProfilerMarker("browser-test", undefined, markerText);
ChromeUtils.addProfilerMarker(markerName, {category: "Test"}, markerText);
},
setDuration: function setDuration(duration) {

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

@ -803,7 +803,7 @@ Tester.prototype = {
name = name.slice(name.lastIndexOf("/") + 1);
ChromeUtils.addProfilerMarker(
"browser-test",
this.lastStartTimestamp,
{ category: "Test", startTime: this.lastStartTimestamp },
name
);
let time = Date.now() - this.lastStartTime;
@ -1118,9 +1118,9 @@ Tester.prototype = {
}
PromiseTestUtils.assertNoUncaughtRejections();
ChromeUtils.addProfilerMarker(
"browser-test",
startTimestamp,
task.name.replace(/^bound /, "") || "task"
"task",
{ category: "Test", startTime: startTimestamp },
task.name.replace(/^bound /, "") || undefined
);
this.SimpleTest.info("Leaving test " + task.name);
}

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

@ -715,7 +715,7 @@ TestRunner.testFinished = function(tests) {
SpecialPowers.addProfilerMarker(
"TestRunner",
TestRunner._currentTestStartTimestamp,
{ category: "Test", startTime: TestRunner._currentTestStartTimestamp },
TestRunner.currentTestURL
);
var runtime = new Date().valueOf() - TestRunner._currentTestStartTime;

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

@ -721,7 +721,11 @@ class SpecialPowersParent extends JSWindowActorParent {
**/
// eslint-disable-next-line complexity
receiveMessage(aMessage) {
ChromeUtils.addProfilerMarker("SpecialPowers", undefined, aMessage.name);
ChromeUtils.addProfilerMarker(
"SpecialPowers",
{ category: "Test" },
aMessage.name
);
// We explicitly return values in the below code so that this function
// doesn't trigger a flurry of warnings about "does not always return

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

@ -644,12 +644,16 @@ function _execute_test() {
if (cleanupStartTime) {
ChromeUtils.addProfilerMarker(
"xpcshell-test",
cleanupStartTime,
{ category: "Test", startTime: cleanupStartTime },
"Cleanup functions"
);
}
ChromeUtils.addProfilerMarker("xpcshell-test", startTime, _TEST_NAME);
ChromeUtils.addProfilerMarker(
"xpcshell-test",
{ category: "Test", startTime },
_TEST_NAME
);
_Services.obs.notifyObservers(null, "test-complete");
// Restore idle service to avoid leaks.
@ -709,9 +713,9 @@ function _load_files(aFiles) {
let startTime = Cu.now();
load(element);
ChromeUtils.addProfilerMarker(
"xpcshell-test",
startTime,
"load " + element.replace(/.*\/_?tests\/xpcshell\//, "")
"load_file",
{ category: "Test", startTime },
element.replace(/.*\/_?tests\/xpcshell\//, "")
);
} catch (e) {
let extra = {
@ -737,7 +741,7 @@ function _wrap_with_quotes_if_necessary(val) {
* Prints a message to the output log.
*/
function info(msg, data) {
ChromeUtils.addProfilerMarker("xpcshell-test", undefined, "INFO " + msg);
ChromeUtils.addProfilerMarker("INFO", { category: "Test" }, msg);
msg = _wrap_with_quotes_if_necessary(msg);
data = data ? data : null;
_testLogger.info(msg, data);
@ -1621,9 +1625,9 @@ function run_next_test() {
result => {
_gTaskRunning = false;
ChromeUtils.addProfilerMarker(
"xpcshell-test",
startTime,
_gRunningTest.name || "task"
"task",
{ category: "Test", startTime },
_gRunningTest.name || undefined
);
if (_isGenerator(result)) {
Assert.ok(false, "Task returned a generator");
@ -1633,9 +1637,9 @@ function run_next_test() {
ex => {
_gTaskRunning = false;
ChromeUtils.addProfilerMarker(
"xpcshell-test",
startTime,
_gRunningTest.name || "task"
"task",
{ category: "Test", startTime },
_gRunningTest.name || undefined
);
try {
do_report_unexpected_exception(ex);
@ -1655,7 +1659,7 @@ function run_next_test() {
} finally {
ChromeUtils.addProfilerMarker(
"xpcshell-test",
startTime,
{ category: "Test", startTime },
_gRunningTest.name || undefined
);
}
@ -1707,7 +1711,7 @@ try {
_TelemetryController.testRegisterJsProbes().finally(() => {
ChromeUtils.addProfilerMarker(
"xpcshell-test",
startTime,
{ category: "Test", startTime },
"TelemetryController.testRegisterJsProbes"
);
complete = true;