diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-03-13 04:30:22 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-03-13 04:30:22 +0000 |
commit | eb030f647c066da594c612db4ba482612842361e (patch) | |
tree | be8671633087ba276cac332fce017744b724eed0 | |
parent | 993a40ed9233e2b250978bcef385154818db3adb (diff) |
[Author: dmaclach]
Fixes up the leaks in the tests.
Sets up the RunMacOSUnitTest script so that it actually works correctly
with respect to enabling leaks.
DELTA=20 (4 added, 3 deleted, 13 changed)
R=thomasvl
-rw-r--r-- | AppKit/GTMGetURLHandlerTest.m | 3 | ||||
-rw-r--r-- | Foundation/GTMSQLite.m | 21 | ||||
-rw-r--r-- | Foundation/GTMSQLiteTest.m | 5 | ||||
-rwxr-xr-x | UnitTesting/RunMacOSUnitTests.sh | 4 |
4 files changed, 17 insertions, 16 deletions
diff --git a/AppKit/GTMGetURLHandlerTest.m b/AppKit/GTMGetURLHandlerTest.m index 30aa82f..ba0be7d 100644 --- a/AppKit/GTMGetURLHandlerTest.m +++ b/AppKit/GTMGetURLHandlerTest.m @@ -46,8 +46,7 @@ static BOOL sURLHandlerWasHit; NSAppleEventDescriptor *keyDesc = [NSAppleEventDescriptor descriptorWithString:url]; [event setParamDescriptor:keyDesc forKeyword:keyDirectObject]; - AppleEvent replyEvent = { typeNull, NULL }; - OSStatus err = AESendMessage([event aeDesc], &replyEvent, kAEWaitReply, 60); + OSStatus err = AESendMessage([event aeDesc], NULL, kAEWaitReply, 60); return err == noErr ? YES : NO; } diff --git a/Foundation/GTMSQLite.m b/Foundation/GTMSQLite.m index 0c7df2e..0225ff5 100644 --- a/Foundation/GTMSQLite.m +++ b/Foundation/GTMSQLite.m @@ -240,9 +240,10 @@ static CFLocaleRef gCurrentLocale = NULL; if (db_) { int rc = sqlite3_close(db_); if (rc != SQLITE_OK) { - _GTMDevLog(@"Unable to close \"%@\", error code: %d", self, rc); - _GTMDevLog(@"Did you forget to call -[GTMSQLiteStatement" - @" finalizeStatement] on one of your statements?"); + _GTMDevLog(@"Unable to close \"%@\", error code: %d\r" + @"Did you forget to call -[GTMSQLiteStatement" + @" finalizeStatement] on one of your statements?", + self, rc); } } [path_ release]; @@ -1717,17 +1718,19 @@ static void Glob16(sqlite3_context *context, int argc, sqlite3_value **argv) { #if GTM_SUPPORT_GC - (void)finalize { - _GTMDevAssert(!statement_, - @"-[GTMSQLiteStatement finalizeStatement] must be called when" - @" statement is no longer needed"); + if (statement_) { + _GTMDevLog(@"-[GTMSQLiteStatement finalizeStatement] must be called when" + @" statement is no longer needed"); + } [super finalize]; } #endif - (void)dealloc { - _GTMDevAssert(!statement_, - @"-[GTMSQLiteStatement finalizeStatement] must be called when" - @" statement is no longer needed"); + if (statement_) { + _GTMDevLog(@"-[GTMSQLiteStatement finalizeStatement] must be called when" + @" statement is no longer needed"); + } [super dealloc]; } diff --git a/Foundation/GTMSQLiteTest.m b/Foundation/GTMSQLiteTest.m index 493493a..5d683c0 100644 --- a/Foundation/GTMSQLiteTest.m +++ b/Foundation/GTMSQLiteTest.m @@ -1776,9 +1776,8 @@ static NSArray* LikeGlobTestHelper(GTMSQLiteDatabase *db, NSString *sql) { @"when statement is no longer needed"; [GTMUnitTestDevLog expectString:expectedLog]; - - STAssertThrows([localPool drain], - @"Failing to clean up database did not throw assertion!"); + [GTMUnitTestDevLog expectPattern:@"Unable to close .*"]; + [localPool drain]; } } diff --git a/UnitTesting/RunMacOSUnitTests.sh b/UnitTesting/RunMacOSUnitTests.sh index 7b5e0a0..87f678f 100755 --- a/UnitTesting/RunMacOSUnitTests.sh +++ b/UnitTesting/RunMacOSUnitTests.sh @@ -165,6 +165,7 @@ RunTests() { AppendToSymbolsLeaksShouldIgnore "+[IKSFEffectDescription initialize]" # Running leaks on architectures that support leaks. + export MallocStackLogging=YES export GTM_LEAKS_SYMBOLS_TO_IGNORE="${GTM_LEAKS_SYMBOLS_TO_IGNORE}" ARCHS="${LEAK_TEST_ARCHS}" VALID_ARCHS="${LEAK_TEST_ARCHS}" @@ -182,7 +183,6 @@ RunTests() { export MallocScribble=YES export MallocPreScribble=YES export MallocGuardEdges=YES -export MallocStackLogging=YES export NSAutoreleaseFreedObjectCheckEnabled=YES export OBJC_DEBUG_FRAGILE_SUPERCLASSES=YES @@ -206,7 +206,7 @@ fi # If leaks testing is enabled, we have to go through our convoluted path # to handle architectures that don't allow us to do leak testing. -if [ GTM_ENABLE_LEAKS ]; then +if [ $GTM_ENABLE_LEAKS ]; then RunTests else "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" |