From 21a242acfe29ba775d653d6bc5a0824052f8cd30 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 1 Dec 2014 14:54:22 +0100 Subject: [PATCH] Fix (possibly?) the problem of paths in liblinphone tester --- LinphoneTester Tests/LinphoneTester_Tests.m | 32 ++++++++------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/LinphoneTester Tests/LinphoneTester_Tests.m b/LinphoneTester Tests/LinphoneTester_Tests.m index 3b783aa9f..2a1d2a203 100644 --- a/LinphoneTester Tests/LinphoneTester_Tests.m +++ b/LinphoneTester Tests/LinphoneTester_Tests.m @@ -17,7 +17,6 @@ @end @implementation LinphoneTester_Tests - static void linphone_log_function(OrtpLogLevel lev, const char *fmt, va_list args) { NSString* log = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:fmt] arguments:args]; NSLog(@"%@",log); @@ -32,23 +31,6 @@ void LSLog(NSString* fmt, ...){ } - - -- (id)init { - self = [super init]; - if( self ){ - self.bundlePath = [[NSBundle mainBundle] bundlePath]; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - self.documentPath = [paths objectAtIndex:0]; - LSLog(@"Bundle path: %@", self.bundlePath); - LSLog(@"Document path: %@", self.documentPath); - - liblinphone_tester_set_fileprefix([self.bundlePath UTF8String]); - liblinphone_tester_set_writable_dir_prefix( [self.documentPath UTF8String] ); - } - return self; -} - + (NSArray*)skippedSuites { NSArray* skipped_suites = @[@"Flexisip"]; return skipped_suites; @@ -61,8 +43,20 @@ void LSLog(NSString* fmt, ...){ } + + (void)initialize { + + static char * bundle = NULL; + static char * documents = NULL; liblinphone_tester_init(); + NSString* bundlePath = [[NSBundle mainBundle] bundlePath]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString* documentPath = [paths objectAtIndex:0]; + bundle = ms_strdup([bundlePath UTF8String]); + documents = ms_strdup([documentPath UTF8String]); + + LSLog(@"Bundle path: %@", bundlePath); + LSLog(@"Document path: %@", documentPath); int count = liblinphone_tester_nb_test_suites(); @@ -91,12 +85,10 @@ void LSLog(NSString* fmt, ...){ - (void)setUp { [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; }