TestsLiblinphone: fix invalid cache directory

This commit is contained in:
Gautier Pelloux-Prayer 2016-06-07 14:38:33 +02:00
parent ac330b8d08
commit c75458cff2
4 changed files with 17 additions and 20 deletions

View file

@ -31,10 +31,12 @@
NSError *error; NSError *error;
// cache directory must be created if not existing // cache directory must be created if not existing
if (![[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO) { if (![[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO) {
[[NSFileManager defaultManager] createDirectoryAtPath:cachePath if (![[NSFileManager defaultManager] createDirectoryAtPath:cachePath
withIntermediateDirectories:NO withIntermediateDirectories:NO
attributes:nil attributes:nil
error:&error]; error:&error]) {
LOGE(@"Could not create cache directory: %@", error);
}
} }
return cachePath; return cachePath;
} }

View file

@ -17,7 +17,7 @@
@interface MasterView () { @interface MasterView () {
NSMutableArray *_objects; NSMutableArray *_objects;
NSString *bundlePath; NSString *bundlePath;
NSString *documentPath; NSString *writablePath;
} }
@end @end
@ -58,19 +58,19 @@ void tester_logs_handler(int level, const char *fmt, va_list args) {
liblinphone_tester_keep_accounts(TRUE); liblinphone_tester_keep_accounts(TRUE);
bundlePath = [[NSBundle mainBundle] bundlePath]; bundlePath = [[NSBundle mainBundle] bundlePath];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
documentPath = [paths objectAtIndex:0]; writablePath = [paths objectAtIndex:0];
bc_tester_init(tester_logs_handler, ORTP_MESSAGE, ORTP_ERROR, "rcfiles"); bc_tester_init(tester_logs_handler, ORTP_MESSAGE, ORTP_ERROR, "rcfiles");
liblinphone_tester_add_suites(); liblinphone_tester_add_suites();
bc_tester_set_resource_dir_prefix([bundlePath UTF8String]); 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; liblinphonetester_ipv6 = true;
LOGI(@"Bundle path: %@", bundlePath); LOGI(@"Bundle path: %@", bundlePath);
LOGI(@"Document path: %@", documentPath); LOGI(@"Writable path: %@", writablePath);
liblinphonetester_ipv6 = true; liblinphonetester_ipv6 = true;

View file

@ -35,9 +35,6 @@ void tester_logs_handler(int level, const char *fmt, va_list args) {
} }
+ (void)initialize { + (void)initialize {
static char *bundle = NULL;
static char *documents = NULL;
// turn off logs since jenkins fails to parse output otherwise. If // turn off logs since jenkins fails to parse output otherwise. If
// you want to debug a specific test, comment this temporary // you want to debug a specific test, comment this temporary
[Log enableLogs:ORTP_WARNING]; [Log enableLogs:ORTP_WARNING];
@ -46,16 +43,14 @@ void tester_logs_handler(int level, const char *fmt, va_list args) {
liblinphone_tester_add_suites(); liblinphone_tester_add_suites();
NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentPath = [paths objectAtIndex:0]; NSString *writablePath = [paths objectAtIndex:0];
bundle = ms_strdup([bundlePath UTF8String]);
documents = ms_strdup([documentPath UTF8String]);
LOGI(@"Bundle path: %@", bundlePath); LOGI(@"Bundle path: %@", bundlePath);
LOGI(@"Document path: %@", documentPath); LOGI(@"Document path: %@", writablePath);
bc_tester_set_resource_dir_prefix(bundle); bc_tester_set_resource_dir_prefix(bundlePath.UTF8String);
bc_tester_set_writable_dir_prefix(documents); bc_tester_set_writable_dir_prefix(writablePath.UTF8String);
liblinphone_tester_keep_accounts(TRUE); liblinphone_tester_keep_accounts(TRUE);
int count = bc_tester_nb_suites(); int count = bc_tester_nb_suites();

@ -1 +1 @@
Subproject commit 73e1013cc153f440e4ba0e9ca7e6a26ac8c02c40 Subproject commit dca7132fe4c07bc7fd62ebecbcd0efa576875c70