зеркало из https://github.com/mozilla/pjs.git
Only run assertion checks in DEBUG builds. (Bug 472557) r=Waldo,bsmedberg
This commit is contained in:
Родитель
971fb409d5
Коммит
8a84734774
|
@ -866,37 +866,39 @@ function DoAssertionCheck()
|
|||
{
|
||||
gClearingForAssertionCheck = false;
|
||||
|
||||
// TEMPORARILY DISABLING ASSERTION CHECKS FOR NOW. TO RE-ENABLE,
|
||||
// USE COMMENTED LINE TO REPLACE FOLLOWING ONE.
|
||||
// var newAssertionCount = gDebug.assertionCount;
|
||||
var newAssertionCount = 0;
|
||||
var numAsserts = newAssertionCount - gAssertionCount;
|
||||
gAssertionCount = newAssertionCount;
|
||||
if (gDebug.isDebugBuild) {
|
||||
// TEMPORARILY DISABLING ASSERTION CHECKS FOR NOW. TO RE-ENABLE,
|
||||
// USE COMMENTED LINE TO REPLACE FOLLOWING ONE.
|
||||
// var newAssertionCount = gDebug.assertionCount;
|
||||
var newAssertionCount = 0;
|
||||
var numAsserts = newAssertionCount - gAssertionCount;
|
||||
gAssertionCount = newAssertionCount;
|
||||
|
||||
var minAsserts = gURLs[0].minAsserts;
|
||||
var maxAsserts = gURLs[0].maxAsserts;
|
||||
var minAsserts = gURLs[0].minAsserts;
|
||||
var maxAsserts = gURLs[0].maxAsserts;
|
||||
|
||||
var expectedAssertions = "expected " + minAsserts;
|
||||
if (minAsserts != maxAsserts) {
|
||||
expectedAssertions += " to " + maxAsserts;
|
||||
}
|
||||
expectedAssertions += " assertions";
|
||||
var expectedAssertions = "expected " + minAsserts;
|
||||
if (minAsserts != maxAsserts) {
|
||||
expectedAssertions += " to " + maxAsserts;
|
||||
}
|
||||
expectedAssertions += " assertions";
|
||||
|
||||
if (numAsserts < minAsserts) {
|
||||
++gTestResults.AssertionUnexpectedFixed;
|
||||
dump("REFTEST TEST-UNEXPECTED-PASS | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " is less than " +
|
||||
expectedAssertions + "\n");
|
||||
} else if (numAsserts > maxAsserts) {
|
||||
++gTestResults.AssertionUnexpected;
|
||||
dump("REFTEST TEST-UNEXPECTED-FAIL | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " is more than " +
|
||||
expectedAssertions + "\n");
|
||||
} else if (numAsserts != 0) {
|
||||
++gTestResults.AssertionKnown;
|
||||
dump("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " matches " +
|
||||
expectedAssertions + "\n");
|
||||
if (numAsserts < minAsserts) {
|
||||
++gTestResults.AssertionUnexpectedFixed;
|
||||
dump("REFTEST TEST-UNEXPECTED-PASS | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " is less than " +
|
||||
expectedAssertions + "\n");
|
||||
} else if (numAsserts > maxAsserts) {
|
||||
++gTestResults.AssertionUnexpected;
|
||||
dump("REFTEST TEST-UNEXPECTED-FAIL | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " is more than " +
|
||||
expectedAssertions + "\n");
|
||||
} else if (numAsserts != 0) {
|
||||
++gTestResults.AssertionKnown;
|
||||
dump("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].prettyPath +
|
||||
" | assertion count " + numAsserts + " matches " +
|
||||
expectedAssertions + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
// And start the next test.
|
||||
|
|
|
@ -137,6 +137,17 @@ nsDebugImpl::Abort(const char *aFile, PRInt32 aLine)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDebugImpl::GetIsDebugBuild(PRBool* aResult)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
*aResult = PR_TRUE;
|
||||
#else
|
||||
*aResult = PR_FALSE;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDebugImpl::GetAssertionCount(PRInt32* aResult)
|
||||
{
|
||||
|
|
|
@ -39,9 +39,16 @@
|
|||
|
||||
#include "nsIDebug.idl"
|
||||
|
||||
[scriptable, uuid(15c0b474-fedb-4789-878b-def834b84735)]
|
||||
[scriptable, uuid(9c9307ed-480a-4f2a-8f29-21378c03bcbc)]
|
||||
interface nsIDebug2 : nsIDebug
|
||||
{
|
||||
/**
|
||||
* Whether XPCOM was compiled with DEBUG defined. This often
|
||||
* correlates to whether other code (e.g., Firefox, XULRunner) was
|
||||
* compiled with DEBUG defined.
|
||||
*/
|
||||
readonly attribute boolean isDebugBuild;
|
||||
|
||||
/**
|
||||
* The number of assertions since process start.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче