Bug 933502 - Make memory reporter mochitests work with ASAN. r=gps,me.

--HG--
extra : rebase_source : 325ee35d47aa38d1cc28008f449fce5fb3a658fc
This commit is contained in:
Nicholas Nethercote 2013-10-31 19:19:10 -07:00
parent 28b52f59f7
commit b75982ecc9
4 changed files with 13 additions and 21 deletions

View File

@ -1,12 +0,0 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef MOZ_ASAN
MOCHITEST_CHROME_FILES += \
remote.xul \
test_memoryReporters.xul \
test_memoryReporters2.xul \
$(NULL)
endif

View File

@ -4,9 +4,12 @@ support-files =
memory-reports-diff1.json
memory-reports-diff2.json
memory-reports-good.json
remote.xul
[test_aboutmemory.xul]
[test_aboutmemory2.xul]
[test_aboutmemory3.xul]
[test_aboutmemory4.xul]
[test_memoryReporters.xul]
[test_memoryReporters2.xul]
[test_sqliteMultiReporter.xul]

View File

@ -179,12 +179,12 @@
dummy = r.name;
}
function checkSpecialReport(aName, aAmounts)
function checkSpecialReport(aName, aAmounts, aCanBeUnreasonable)
{
ok(aAmounts.length == 1, aName + " has " + aAmounts.length + " report");
let n = aAmounts[0];
// Check the size is reasonable -- i.e. not ridiculously large or small.
ok(100 * 1000 <= n && n <= 10 * 1000 * 1000 * 1000,
ok((100 * 1000 <= n && n <= 10 * 1000 * 1000 * 1000) || aCanBeUnreasonable,
aName + "'s size is reasonable");
}
@ -192,7 +192,8 @@
if (haveExplicit) {
checkSpecialReport("heap-allocated", heapAllocatedAmounts);
}
checkSpecialReport("vsize", vsizeAmounts);
// vsize may be unreasonable if ASAN is enabled
checkSpecialReport("vsize", vsizeAmounts, /*canBeUnreasonable*/true);
checkSpecialReport("resident", residentAmounts);
checkSpecialReport("js-main-runtime-gc-heap-committed/used/gc-things", jsGcHeapAmounts);

View File

@ -64,7 +64,7 @@
numUpdates++;
if (numUpdates == numRemotes) {
// All the remote processes have reported back. Check reports.
let vsizes = {};
let residents = {};
// Get all the reports.
let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
@ -73,10 +73,10 @@
while (e.hasMoreElements()) {
let r = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
r.collectReports(function(aProcess, aPath, aKind, aUnits, aAmount, aDesc) {
if (aPath === "vsize") {
if (aPath === "resident") {
ok(100 * 1000 <= aAmount && aAmount <= 10 * 1000 * 1000 * 1000,
"vsize is reasonable");
vsizes[aProcess] = aAmount;
"resident is reasonable");
residents[aProcess] = aAmount;
}
}, null);
}
@ -88,8 +88,8 @@
// Check the results.
let processes = Object.keys(vsizes);
ok(processes.length == numRemotes + 1, "correct vsize count");
let processes = Object.keys(residents);
ok(processes.length == numRemotes + 1, "correct resident count");
let numEmptyProcesses = 0, numNonEmptyProcesses = 0;
for (let i = 0; i < processes.length; i++) {