Bug 940637 - part 3 - change MemoryStats.dump to dump about:memory and DMD if instructed; r=jmaher

This commit is contained in:
Nathan Froyd 2013-11-21 13:03:19 -05:00
Родитель ab1d6f8b03
Коммит 87208c320a
3 изменённых файлов: 35 добавлений и 3 удалений

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

@ -1,3 +1,4 @@
/* -*- js-indent-level: 2; tab-width: 2; indent-tabs-mode: nil -*- */
// Test timeout (seconds)
var gTimeoutSeconds = 30;
var gConfig;
@ -364,7 +365,12 @@ Tester.prototype = {
.getService(Ci.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT)
{
this.MemoryStats.dump((l) => { this.dumper.dump(l + "\n"); });
this.MemoryStats.dump((l) => { this.dumper.dump(l + "\n"); },
this.currentTestIndex,
this.currentTest.path,
gConfig.dumpOutputDirectory,
gConfig.dumpAboutMemoryAfterTest,
gConfig.dumpDMDAfterTest);
}
// Note the test run time

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

@ -35,7 +35,12 @@ MemoryStats._getService = function (className, interfaceName) {
return service;
}
MemoryStats.dump = function (dumpFn) {
MemoryStats.dump = function (dumpFn,
testNumber,
testURL,
dumpOutputDirectory,
dumpAboutMemory,
dumpDMD) {
var mrm = MemoryStats._getService("@mozilla.org/memory-reporter-manager;1",
"nsIMemoryReporterManager");
for (var stat in MemoryStats._hasMemoryStatistics) {
@ -57,4 +62,21 @@ MemoryStats.dump = function (dumpFn) {
dumpFn("TEST-INFO | MEMORY STAT " + stat + " not supported in this build configuration.");
}
}
if (dumpAboutMemory) {
var dumpfile = dumpOutputDirectory + "/about-memory-" + testNumber + ".json.gz";
dumpFn("TEST-INFO | " + testURL + " | MEMDUMP-START " + dumpfile);
var md = MemoryStats._getService("@mozilla.org/memory-info-dumper;1",
"nsIMemoryInfoDumper");
md.dumpMemoryReportsToNamedFile(dumpfile, function () {
dumpFn("TEST-INFO | " + testURL + " | MEMDUMP-END");
}, null);
}
if (dumpDMD && typeof(DMDReportAndDump) != undefined) {
var dumpfile = dumpOutputDirectory + "/dmd-" + testNumber + ".txt";
dumpFn("TEST-INFO | " + testURL + " | DMD-DUMP " + dumpfile);
DMDReportAndDump(dumpfile);
}
};

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

@ -413,7 +413,11 @@ TestRunner.testFinished = function(tests) {
TestRunner._lastTestFinished = TestRunner._currentTest;
TestRunner._loopIsRestarting = false;
MemoryStats.dump(TestRunner.log);
MemoryStats.dump(TestRunner.log, TestRunner._currentTest,
TestRunner.currentTestURL,
TestRunner.dumpOutputDirectory,
TestRunner.dumpAboutMemoryAfterTest,
TestRunner.dumpDMDAfterTest);
function cleanUpCrashDumpFiles() {
if (!SpecialPowers.removeExpectedCrashDumpFiles(TestRunner._expectingProcessCrash)) {