mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Backed out 2 changesets (bug 1471573) for mochitest failures on testAudioFocus.
Backed out changeset cdfcca543396 (bug 1471573) Backed out changeset e7272b60f48f (bug 1471573)
This commit is contained in:
parent
775acfe216
commit
0f160fe737
@ -29,7 +29,6 @@ const whitelist = {
|
||||
"resource://specialpowers/MockColorPicker.jsm",
|
||||
"resource://specialpowers/MockFilePicker.jsm",
|
||||
"resource://specialpowers/MockPermissionPrompt.jsm",
|
||||
"resource://testing-common/PerTestCoverageUtils.jsm",
|
||||
|
||||
// General utilities
|
||||
"resource://gre/modules/AppConstants.jsm",
|
||||
|
@ -423,7 +423,6 @@ function Tester(aTests, structuredLogger, aCallback) {
|
||||
this.Promise = ChromeUtils.import("resource://gre/modules/Promise.jsm", null).Promise;
|
||||
this.PromiseTestUtils = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", null).PromiseTestUtils;
|
||||
this.Assert = ChromeUtils.import("resource://testing-common/Assert.jsm", null).Assert;
|
||||
this.PerTestCoverageUtils = ChromeUtils.import("resource://testing-common/PerTestCoverageUtils.jsm", null).PerTestCoverageUtils;
|
||||
|
||||
this.PromiseTestUtils.init();
|
||||
|
||||
@ -502,8 +501,6 @@ Tester.prototype = {
|
||||
this._coverageCollector = new CoverageCollector(coveragePath);
|
||||
}
|
||||
|
||||
this.PerTestCoverageUtils.beforeTestSync();
|
||||
|
||||
this.structuredLogger.info("*** Start BrowserChrome Test Results ***");
|
||||
Services.console.registerListener(this);
|
||||
this._globalProperties = Object.keys(window);
|
||||
@ -693,8 +690,6 @@ Tester.prototype = {
|
||||
this._coverageCollector.recordTestCoverage(this.currentTest.path);
|
||||
}
|
||||
|
||||
this.PerTestCoverageUtils.afterTestSync();
|
||||
|
||||
// Run cleanup functions for the current test before moving on to the
|
||||
// next one.
|
||||
let testScope = this.currentTest.scope;
|
||||
|
@ -365,22 +365,20 @@ TestRunner.runTests = function (/*url...*/) {
|
||||
coverageCollector = new CoverageCollector(TestRunner.jscovDirPrefix);
|
||||
}
|
||||
|
||||
SpecialPowers.requestResetCoverageCounters().then(() => {
|
||||
TestRunner._urls = flattenArguments(arguments);
|
||||
TestRunner._urls = flattenArguments(arguments);
|
||||
|
||||
var singleTestRun = this._urls.length <= 1 && TestRunner.repeat <= 1;
|
||||
TestRunner.showTestReport = singleTestRun;
|
||||
var frame = $('testframe');
|
||||
frame.src = "";
|
||||
if (singleTestRun) {
|
||||
// Can't use document.body because this runs in a XUL doc as well...
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
body.setAttribute("singletest", "true");
|
||||
frame.removeAttribute("scrolling");
|
||||
}
|
||||
TestRunner._checkForHangs();
|
||||
TestRunner.runNextTest();
|
||||
});
|
||||
var singleTestRun = this._urls.length <= 1 && TestRunner.repeat <= 1;
|
||||
TestRunner.showTestReport = singleTestRun;
|
||||
var frame = $('testframe');
|
||||
frame.src = "";
|
||||
if (singleTestRun) {
|
||||
// Can't use document.body because this runs in a XUL doc as well...
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
body.setAttribute("singletest", "true");
|
||||
frame.removeAttribute("scrolling");
|
||||
}
|
||||
TestRunner._checkForHangs();
|
||||
TestRunner.runNextTest();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -531,122 +529,120 @@ TestRunner.testFinished = function(tests) {
|
||||
coverageCollector.recordTestCoverage(TestRunner.currentTestURL);
|
||||
}
|
||||
|
||||
SpecialPowers.requestDumpCoverageCounters().then(() => {
|
||||
TestRunner._lastTestFinished = TestRunner._currentTest;
|
||||
TestRunner._loopIsRestarting = false;
|
||||
TestRunner._lastTestFinished = TestRunner._currentTest;
|
||||
TestRunner._loopIsRestarting = false;
|
||||
|
||||
// TODO : replace this by a function that returns the mem data as an object
|
||||
// that's dumped later with the test_end message
|
||||
MemoryStats.dump(TestRunner._currentTest,
|
||||
TestRunner.currentTestURL,
|
||||
TestRunner.dumpOutputDirectory,
|
||||
TestRunner.dumpAboutMemoryAfterTest,
|
||||
TestRunner.dumpDMDAfterTest);
|
||||
// TODO : replace this by a function that returns the mem data as an object
|
||||
// that's dumped later with the test_end message
|
||||
MemoryStats.dump(TestRunner._currentTest,
|
||||
TestRunner.currentTestURL,
|
||||
TestRunner.dumpOutputDirectory,
|
||||
TestRunner.dumpAboutMemoryAfterTest,
|
||||
TestRunner.dumpDMDAfterTest);
|
||||
|
||||
function cleanUpCrashDumpFiles() {
|
||||
if (!SpecialPowers.removeExpectedCrashDumpFiles(TestRunner._expectingProcessCrash)) {
|
||||
var subtest = "expected-crash-dump-missing";
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
subtest,
|
||||
"ERROR",
|
||||
"PASS",
|
||||
"This test did not leave any crash dumps behind, but we were expecting some!");
|
||||
extraTests.push({ name: subtest, result: false });
|
||||
result = "ERROR";
|
||||
}
|
||||
|
||||
var unexpectedCrashDumpFiles =
|
||||
SpecialPowers.findUnexpectedCrashDumpFiles();
|
||||
TestRunner._expectingProcessCrash = false;
|
||||
if (unexpectedCrashDumpFiles.length) {
|
||||
var subtest = "unexpected-crash-dump-found";
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
subtest,
|
||||
"ERROR",
|
||||
"PASS",
|
||||
"This test left crash dumps behind, but we " +
|
||||
"weren't expecting it to!",
|
||||
null,
|
||||
{unexpected_crashdump_files: unexpectedCrashDumpFiles});
|
||||
extraTests.push({ name: subtest, result: false });
|
||||
result = "CRASH";
|
||||
unexpectedCrashDumpFiles.sort().forEach(function(aFilename) {
|
||||
TestRunner.structuredLogger.info("Found unexpected crash dump file " +
|
||||
aFilename + ".");
|
||||
});
|
||||
}
|
||||
|
||||
if (TestRunner.cleanupCrashes) {
|
||||
if (SpecialPowers.removePendingCrashDumpFiles()) {
|
||||
TestRunner.structuredLogger.info("This test left pending crash dumps");
|
||||
}
|
||||
}
|
||||
function cleanUpCrashDumpFiles() {
|
||||
if (!SpecialPowers.removeExpectedCrashDumpFiles(TestRunner._expectingProcessCrash)) {
|
||||
var subtest = "expected-crash-dump-missing";
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
subtest,
|
||||
"ERROR",
|
||||
"PASS",
|
||||
"This test did not leave any crash dumps behind, but we were expecting some!");
|
||||
extraTests.push({ name: subtest, result: false });
|
||||
result = "ERROR";
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
if (TestRunner.currentTestURL != TestRunner.getLoadedTestURL()) {
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
TestRunner.getLoadedTestURL(),
|
||||
"FAIL",
|
||||
"PASS",
|
||||
"finished in a non-clean fashion, probably" +
|
||||
" because it didn't call SimpleTest.finish()",
|
||||
{loaded_test_url: TestRunner.getLoadedTestURL()});
|
||||
extraTests.push({ name: "clean-finish", result: false });
|
||||
result = result != "CRASH" ? "ERROR": result
|
||||
}
|
||||
|
||||
var runtime = new Date().valueOf() - TestRunner._currentTestStartTime;
|
||||
|
||||
TestRunner.structuredLogger.testEnd(TestRunner.currentTestURL,
|
||||
result,
|
||||
"OK",
|
||||
"Finished in " + runtime + "ms",
|
||||
{runtime: runtime}
|
||||
);
|
||||
|
||||
if (TestRunner.slowestTestTime < runtime && TestRunner._timeoutFactor >= 1) {
|
||||
TestRunner.slowestTestTime = runtime;
|
||||
TestRunner.slowestTestURL = TestRunner.currentTestURL;
|
||||
}
|
||||
|
||||
TestRunner.updateUI(tests.concat(extraTests));
|
||||
|
||||
// Don't show the interstitial if we just run one test with no repeats:
|
||||
if (TestRunner._urls.length == 1 && TestRunner.repeat <= 1) {
|
||||
TestRunner.testUnloaded();
|
||||
return;
|
||||
}
|
||||
|
||||
var interstitialURL;
|
||||
if ($('testframe').contentWindow.location.protocol == "chrome:") {
|
||||
interstitialURL = "tests/SimpleTest/iframe-between-tests.html";
|
||||
} else {
|
||||
interstitialURL = "/tests/SimpleTest/iframe-between-tests.html";
|
||||
}
|
||||
// check if there were test run after SimpleTest.finish, which should never happen
|
||||
$('testframe').contentWindow.addEventListener('unload', function() {
|
||||
var testwin = $('testframe').contentWindow;
|
||||
if (testwin.SimpleTest && testwin.SimpleTest._tests.length != testwin.SimpleTest.testsLength) {
|
||||
var wrongtestlength = testwin.SimpleTest._tests.length - testwin.SimpleTest.testsLength;
|
||||
var wrongtestname = '';
|
||||
for (var i = 0; i < wrongtestlength; i++) {
|
||||
wrongtestname = testwin.SimpleTest._tests[testwin.SimpleTest.testsLength + i].name;
|
||||
TestRunner.structuredLogger.error(TestRunner.currentTestURL + " logged result after SimpleTest.finish(): " + wrongtestname);
|
||||
}
|
||||
TestRunner.updateUI([{ result: false }]);
|
||||
}
|
||||
var unexpectedCrashDumpFiles =
|
||||
SpecialPowers.findUnexpectedCrashDumpFiles();
|
||||
TestRunner._expectingProcessCrash = false;
|
||||
if (unexpectedCrashDumpFiles.length) {
|
||||
var subtest = "unexpected-crash-dump-found";
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
subtest,
|
||||
"ERROR",
|
||||
"PASS",
|
||||
"This test left crash dumps behind, but we " +
|
||||
"weren't expecting it to!",
|
||||
null,
|
||||
{unexpected_crashdump_files: unexpectedCrashDumpFiles});
|
||||
extraTests.push({ name: subtest, result: false });
|
||||
result = "CRASH";
|
||||
unexpectedCrashDumpFiles.sort().forEach(function(aFilename) {
|
||||
TestRunner.structuredLogger.info("Found unexpected crash dump file " +
|
||||
aFilename + ".");
|
||||
});
|
||||
TestRunner._makeIframe(interstitialURL, 0);
|
||||
}
|
||||
|
||||
SpecialPowers.executeAfterFlushingMessageQueue(function() {
|
||||
SpecialPowers.waitForCrashes(TestRunner._expectingProcessCrash)
|
||||
.then(() => {
|
||||
cleanUpCrashDumpFiles();
|
||||
SpecialPowers.flushPermissions(function () {
|
||||
SpecialPowers.flushPrefEnv(runNextTest);
|
||||
});
|
||||
if (TestRunner.cleanupCrashes) {
|
||||
if (SpecialPowers.removePendingCrashDumpFiles()) {
|
||||
TestRunner.structuredLogger.info("This test left pending crash dumps");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
if (TestRunner.currentTestURL != TestRunner.getLoadedTestURL()) {
|
||||
TestRunner.structuredLogger.testStatus(TestRunner.currentTestURL,
|
||||
TestRunner.getLoadedTestURL(),
|
||||
"FAIL",
|
||||
"PASS",
|
||||
"finished in a non-clean fashion, probably" +
|
||||
" because it didn't call SimpleTest.finish()",
|
||||
{loaded_test_url: TestRunner.getLoadedTestURL()});
|
||||
extraTests.push({ name: "clean-finish", result: false });
|
||||
result = result != "CRASH" ? "ERROR": result
|
||||
}
|
||||
|
||||
var runtime = new Date().valueOf() - TestRunner._currentTestStartTime;
|
||||
|
||||
TestRunner.structuredLogger.testEnd(TestRunner.currentTestURL,
|
||||
result,
|
||||
"OK",
|
||||
"Finished in " + runtime + "ms",
|
||||
{runtime: runtime}
|
||||
);
|
||||
|
||||
if (TestRunner.slowestTestTime < runtime && TestRunner._timeoutFactor >= 1) {
|
||||
TestRunner.slowestTestTime = runtime;
|
||||
TestRunner.slowestTestURL = TestRunner.currentTestURL;
|
||||
}
|
||||
|
||||
TestRunner.updateUI(tests.concat(extraTests));
|
||||
|
||||
// Don't show the interstitial if we just run one test with no repeats:
|
||||
if (TestRunner._urls.length == 1 && TestRunner.repeat <= 1) {
|
||||
TestRunner.testUnloaded();
|
||||
return;
|
||||
}
|
||||
|
||||
var interstitialURL;
|
||||
if ($('testframe').contentWindow.location.protocol == "chrome:") {
|
||||
interstitialURL = "tests/SimpleTest/iframe-between-tests.html";
|
||||
} else {
|
||||
interstitialURL = "/tests/SimpleTest/iframe-between-tests.html";
|
||||
}
|
||||
// check if there were test run after SimpleTest.finish, which should never happen
|
||||
$('testframe').contentWindow.addEventListener('unload', function() {
|
||||
var testwin = $('testframe').contentWindow;
|
||||
if (testwin.SimpleTest && testwin.SimpleTest._tests.length != testwin.SimpleTest.testsLength) {
|
||||
var wrongtestlength = testwin.SimpleTest._tests.length - testwin.SimpleTest.testsLength;
|
||||
var wrongtestname = '';
|
||||
for (var i = 0; i < wrongtestlength; i++) {
|
||||
wrongtestname = testwin.SimpleTest._tests[testwin.SimpleTest.testsLength + i].name;
|
||||
TestRunner.structuredLogger.error(TestRunner.currentTestURL + " logged result after SimpleTest.finish(): " + wrongtestname);
|
||||
}
|
||||
TestRunner.updateUI([{ result: false }]);
|
||||
}
|
||||
});
|
||||
TestRunner._makeIframe(interstitialURL, 0);
|
||||
}
|
||||
|
||||
SpecialPowers.executeAfterFlushingMessageQueue(function() {
|
||||
SpecialPowers.waitForCrashes(TestRunner._expectingProcessCrash)
|
||||
.then(() => {
|
||||
cleanUpCrashDumpFiles();
|
||||
SpecialPowers.flushPermissions(function () {
|
||||
SpecialPowers.flushPrefEnv(runNextTest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -891,11 +891,9 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin,
|
||||
|
||||
if self.per_test_coverage:
|
||||
gcov_dir, jsvm_dir = self.set_coverage_env(env)
|
||||
# Per-test reset/dump is only supported for xpcshell/mochitest and
|
||||
# Per-test reset/dump is only supported for xpcshell and
|
||||
# Linux for the time being.
|
||||
if not is_baseline_test and \
|
||||
suite_category in ['mochitest', 'xpcshell'] and \
|
||||
self._is_linux():
|
||||
if not is_baseline_test and suite == 'xpcshell' and self._is_linux():
|
||||
env['GCOV_RESULTS_DIR'] = tempfile.mkdtemp()
|
||||
|
||||
return_code = self.run_command(final_cmd, cwd=dirs['abs_work_dir'],
|
||||
|
@ -11,7 +11,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ExtensionTestCommon: "resource://testing-common/ExtensionTestCommon.jsm",
|
||||
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
PerTestCoverageUtils: "resource://testing-common/PerTestCoverageUtils.jsm",
|
||||
});
|
||||
|
||||
this.SpecialPowersError = function(aMsg) {
|
||||
@ -555,16 +554,16 @@ SpecialPowersObserverAPI.prototype = {
|
||||
}
|
||||
|
||||
case "SPRequestDumpCoverageCounters": {
|
||||
PerTestCoverageUtils.afterTest().then(() =>
|
||||
this._sendReply(aMessage, "SPRequestDumpCoverageCounters", {})
|
||||
);
|
||||
let codeCoverage = Cc["@mozilla.org/tools/code-coverage;1"].
|
||||
getService(Ci.nsICodeCoverage);
|
||||
codeCoverage.dumpCounters();
|
||||
return undefined; // See comment at the beginning of this function.
|
||||
}
|
||||
|
||||
case "SPRequestResetCoverageCounters": {
|
||||
PerTestCoverageUtils.beforeTest().then(() =>
|
||||
this._sendReply(aMessage, "SPRequestResetCoverageCounters", {})
|
||||
);
|
||||
let codeCoverage = Cc["@mozilla.org/tools/code-coverage;1"].
|
||||
getService(Ci.nsICodeCoverage);
|
||||
codeCoverage.resetCounters();
|
||||
return undefined; // See comment at the beginning of this function.
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,9 @@ function SpecialPowers(window) {
|
||||
"SPPrefService",
|
||||
"SPProcessCrashService",
|
||||
"SPSetTestPluginEnabledState",
|
||||
"SPCleanUpSTSData"];
|
||||
"SPCleanUpSTSData",
|
||||
"SPRequestDumpCoverageCounters",
|
||||
"SPRequestResetCoverageCounters"];
|
||||
|
||||
this.SP_ASYNC_MESSAGES = ["SpecialPowers.Focus",
|
||||
"SpecialPowers.Quit",
|
||||
@ -46,9 +48,7 @@ function SpecialPowers(window) {
|
||||
"SPProcessCrashManagerWait",
|
||||
"SPStartupExtension",
|
||||
"SPUnloadExtension",
|
||||
"SPExtensionMessage",
|
||||
"SPRequestDumpCoverageCounters",
|
||||
"SPRequestResetCoverageCounters"];
|
||||
"SPExtensionMessage"];
|
||||
addMessageListener("SPPingService", this._messageListener);
|
||||
addMessageListener("SpecialPowers.FilesCreated", this._messageListener);
|
||||
addMessageListener("SpecialPowers.FilesError", this._messageListener);
|
||||
|
@ -21,7 +21,6 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ServiceWorkerCleanUp.jsm");
|
||||
ChromeUtils.import("resource://testing-common/PerTestCoverageUtils.jsm");
|
||||
|
||||
// We're loaded with "this" not set to the global in some cases, so we
|
||||
// have to play some games to get at the global object here. Normally
|
||||
@ -1983,38 +1982,12 @@ SpecialPowersAPI.prototype = {
|
||||
return this._sendSyncMessage("SPCleanUpSTSData", {origin, flags: flags || 0});
|
||||
},
|
||||
|
||||
requestDumpCoverageCounters(cb) {
|
||||
// We want to avoid a roundtrip between child and parent.
|
||||
if (!PerTestCoverageUtils.enabled) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
let messageListener = _ => {
|
||||
this._removeMessageListener("SPRequestDumpCoverageCounters", messageListener);
|
||||
resolve();
|
||||
};
|
||||
|
||||
this._addMessageListener("SPRequestDumpCoverageCounters", messageListener);
|
||||
this._sendAsyncMessage("SPRequestDumpCoverageCounters", {});
|
||||
});
|
||||
requestDumpCoverageCounters() {
|
||||
this._sendSyncMessage("SPRequestDumpCoverageCounters", {});
|
||||
},
|
||||
|
||||
requestResetCoverageCounters(cb) {
|
||||
// We want to avoid a roundtrip between child and parent.
|
||||
if (!PerTestCoverageUtils.enabled) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
let messageListener = _ => {
|
||||
this._removeMessageListener("SPRequestResetCoverageCounters", messageListener);
|
||||
resolve();
|
||||
};
|
||||
|
||||
this._addMessageListener("SPRequestResetCoverageCounters", messageListener);
|
||||
this._sendAsyncMessage("SPRequestResetCoverageCounters", {});
|
||||
});
|
||||
requestResetCoverageCounters() {
|
||||
this._sendSyncMessage("SPRequestResetCoverageCounters", {});
|
||||
},
|
||||
|
||||
_nextExtensionID: 0,
|
||||
|
@ -26,6 +26,8 @@ if (gcovResultsPath) {
|
||||
gcovResultsDir.initWithPath(gcovResultsPath);
|
||||
}
|
||||
|
||||
const enabled = !!gcovResultsPath;
|
||||
|
||||
function awaitPromise(promise) {
|
||||
let ret;
|
||||
let complete = false;
|
||||
@ -58,7 +60,7 @@ function moveDirectoryContents(src, dst) {
|
||||
var PerTestCoverageUtils = class PerTestCoverageUtilsClass {
|
||||
// Resets the counters to 0.
|
||||
static async beforeTest() {
|
||||
if (!PerTestCoverageUtils.enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +81,7 @@ var PerTestCoverageUtils = class PerTestCoverageUtilsClass {
|
||||
|
||||
// Dumps counters and moves the gcda files in the directory expected by codecoverage.py.
|
||||
static async afterTest() {
|
||||
if (!PerTestCoverageUtils.enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,5 +97,3 @@ var PerTestCoverageUtils = class PerTestCoverageUtilsClass {
|
||||
awaitPromise(this.afterTest());
|
||||
}
|
||||
};
|
||||
|
||||
PerTestCoverageUtils.enabled = !!gcovResultsPath;
|
||||
|
@ -14,15 +14,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1380659
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
(async function() {
|
||||
await SpecialPowers.requestDumpCoverageCounters();
|
||||
SimpleTest.ok(true, "Counters dumped.");
|
||||
SpecialPowers.requestDumpCoverageCounters();
|
||||
SimpleTest.ok(true, "Counters dumped.");
|
||||
|
||||
await SpecialPowers.requestResetCoverageCounters();
|
||||
SimpleTest.ok(true, "Counters reset.");
|
||||
SpecialPowers.requestResetCoverageCounters();
|
||||
SimpleTest.ok(true, "Counters reset.");
|
||||
|
||||
SimpleTest.finish();
|
||||
})();
|
||||
SimpleTest.finish();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user