From c75458cff26b64f0c09aeca4e9af7db8dd73ae8a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 7 Jun 2016 14:38:33 +0200 Subject: [PATCH] TestsLiblinphone: fix invalid cache directory --- Classes/Utils/Log.m | 10 ++++++---- LiblinphoneTester/MasterView.m | 10 +++++----- TestsLiblinphone/LinphoneTester_Tests.m | 15 +++++---------- submodules/linphone | 2 +- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index 62239776e..a493e024c 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -31,10 +31,12 @@ NSError *error; // cache directory must be created if not existing if (![[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO) { - [[NSFileManager defaultManager] createDirectoryAtPath:cachePath - withIntermediateDirectories:NO - attributes:nil - error:&error]; + if (![[NSFileManager defaultManager] createDirectoryAtPath:cachePath + withIntermediateDirectories:NO + attributes:nil + error:&error]) { + LOGE(@"Could not create cache directory: %@", error); + } } return cachePath; } diff --git a/LiblinphoneTester/MasterView.m b/LiblinphoneTester/MasterView.m index faa6fc05a..7e1deff0c 100644 --- a/LiblinphoneTester/MasterView.m +++ b/LiblinphoneTester/MasterView.m @@ -17,7 +17,7 @@ @interface MasterView () { NSMutableArray *_objects; NSString *bundlePath; - NSString *documentPath; + NSString *writablePath; } @end @@ -58,19 +58,19 @@ void tester_logs_handler(int level, const char *fmt, va_list args) { liblinphone_tester_keep_accounts(TRUE); bundlePath = [[NSBundle mainBundle] bundlePath]; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - documentPath = [paths objectAtIndex:0]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + writablePath = [paths objectAtIndex:0]; bc_tester_init(tester_logs_handler, ORTP_MESSAGE, ORTP_ERROR, "rcfiles"); liblinphone_tester_add_suites(); bc_tester_set_resource_dir_prefix([bundlePath UTF8String]); - bc_tester_set_writable_dir_prefix([documentPath UTF8String]); + bc_tester_set_writable_dir_prefix([writablePath UTF8String]); liblinphonetester_ipv6 = true; LOGI(@"Bundle path: %@", bundlePath); - LOGI(@"Document path: %@", documentPath); + LOGI(@"Writable path: %@", writablePath); liblinphonetester_ipv6 = true; diff --git a/TestsLiblinphone/LinphoneTester_Tests.m b/TestsLiblinphone/LinphoneTester_Tests.m index 0214c98a1..540534482 100644 --- a/TestsLiblinphone/LinphoneTester_Tests.m +++ b/TestsLiblinphone/LinphoneTester_Tests.m @@ -35,9 +35,6 @@ void tester_logs_handler(int level, const char *fmt, va_list args) { } + (void)initialize { - static char *bundle = NULL; - static char *documents = NULL; - // turn off logs since jenkins fails to parse output otherwise. If // you want to debug a specific test, comment this temporary [Log enableLogs:ORTP_WARNING]; @@ -46,16 +43,14 @@ void tester_logs_handler(int level, const char *fmt, va_list args) { liblinphone_tester_add_suites(); 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]); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + NSString *writablePath = [paths objectAtIndex:0]; LOGI(@"Bundle path: %@", bundlePath); - LOGI(@"Document path: %@", documentPath); + LOGI(@"Document path: %@", writablePath); - bc_tester_set_resource_dir_prefix(bundle); - bc_tester_set_writable_dir_prefix(documents); + bc_tester_set_resource_dir_prefix(bundlePath.UTF8String); + bc_tester_set_writable_dir_prefix(writablePath.UTF8String); liblinphone_tester_keep_accounts(TRUE); int count = bc_tester_nb_suites(); diff --git a/submodules/linphone b/submodules/linphone index 73e1013cc..dca7132fe 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 73e1013cc153f440e4ba0e9ca7e6a26ac8c02c40 +Subproject commit dca7132fe4c07bc7fd62ebecbcd0efa576875c70