forked from mirrors/linphone-iphone
tester: fix LinphoneTester and LinphoneTester Tests for latest Linphone submodule version
This commit is contained in:
parent
4516d6d9d7
commit
69133ef6dc
4 changed files with 25 additions and 20 deletions
|
|
@ -37,7 +37,7 @@ void LSLog(NSString* fmt, ...){
|
|||
}
|
||||
|
||||
|
||||
+ (NSString*)safeifyTestString:(NSString*)testString{
|
||||
+ (NSString*)safetyTestString:(NSString*)testString{
|
||||
NSCharacterSet *charactersToRemove = [[NSCharacterSet alphanumericCharacterSet] invertedSet];
|
||||
return [[testString componentsSeparatedByCharactersInSet:charactersToRemove] componentsJoinedByString:@"_"];
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ void LSLog(NSString* fmt, ...){
|
|||
|
||||
static char * bundle = NULL;
|
||||
static char * documents = NULL;
|
||||
liblinphone_tester_init();
|
||||
bc_tester_init();
|
||||
|
||||
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
|
|
@ -59,25 +59,27 @@ void LSLog(NSString* fmt, ...){
|
|||
LSLog(@"Bundle path: %@", bundlePath);
|
||||
LSLog(@"Document path: %@", documentPath);
|
||||
|
||||
liblinphone_tester_set_fileprefix(bundle);
|
||||
liblinphone_tester_set_writable_dir_prefix(documents);
|
||||
|
||||
bc_tester_read_dir_prefix = bundle;
|
||||
bc_tester_writable_dir_prefix = documents;
|
||||
|
||||
liblinphone_tester_keep_accounts(TRUE);
|
||||
|
||||
int count = liblinphone_tester_nb_test_suites();
|
||||
int count = bc_tester_nb_test_suites();
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
const char* suite = liblinphone_tester_test_suite_name(i);
|
||||
const char* suite = bc_tester_suite_name(i);
|
||||
|
||||
int test_count = liblinphone_tester_nb_tests(suite);
|
||||
int test_count = bc_tester_nb_tests(suite);
|
||||
for( int k = 0; k<test_count; k++){
|
||||
const char* test =liblinphone_tester_test_name(suite, k);
|
||||
const char* test =bc_tester_test_name(suite, k);
|
||||
NSString* sSuite = [NSString stringWithUTF8String:suite];
|
||||
NSString* sTest = [NSString stringWithUTF8String:test];
|
||||
|
||||
if( [[LinphoneTester_Tests skippedSuites] containsObject:sSuite] ) continue;
|
||||
// prepend "test_" so that it gets found by introspection
|
||||
NSString* safesTest = [self safeifyTestString:sTest];
|
||||
NSString* safesSuite = [self safeifyTestString:sSuite];
|
||||
NSString* safesTest = [self safetyTestString:sTest];
|
||||
NSString* safesSuite = [self safetyTestString:sSuite];
|
||||
NSString *selectorName = [NSString stringWithFormat:@"test_%@__%@", safesSuite, safesTest];
|
||||
|
||||
[LinphoneTester_Tests addInstanceMethodWithSelectorName:selectorName block:^(LinphoneTester_Tests* myself) {
|
||||
|
|
@ -100,7 +102,7 @@ void LSLog(NSString* fmt, ...){
|
|||
- (void)testForSuite:(NSString*)suite andTest:(NSString*)test
|
||||
{
|
||||
LSLog(@"Launching test %@ from suite %@", test, suite);
|
||||
XCTAssertFalse(liblinphone_tester_run_tests([suite UTF8String], [test UTF8String]), @"Suite '%@' / Test '%@' failed", suite, test);
|
||||
XCTAssertFalse(bc_tester_run_tests([suite UTF8String], [test UTF8String]), @"Suite '%@' / Test '%@' failed", suite, test);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ static NSString* const kAllTestsName = @"Run All tests";
|
|||
const char* suite = [self.detailItem UTF8String];
|
||||
if( suite == NULL ) return;
|
||||
NSString* nssuite = [NSString stringWithUTF8String:suite];
|
||||
int count = liblinphone_tester_nb_tests(suite);
|
||||
int count = bc_tester_nb_tests(suite);
|
||||
_tests = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
|
||||
[_tests addObject:[TestItem testWithName:kAllTestsName fromSuite:nssuite]];
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
const char* test_name = liblinphone_tester_test_name(suite, i);
|
||||
const char* test_name = bc_tester_test_name(suite, i);
|
||||
TestItem* item = [[TestItem alloc] initWithName:[NSString stringWithUTF8String:test_name] fromSuite:nssuite];
|
||||
[_tests addObject:item];
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ static NSString* const kAllTestsName = @"Run All tests";
|
|||
TestItem *test = _tests[path.row];
|
||||
LSLog(@"Should launch test %@", test);
|
||||
|
||||
BOOL fail = liblinphone_tester_run_tests([test.suite UTF8String], [test.name UTF8String]);
|
||||
BOOL fail = bc_tester_run_tests([test.suite UTF8String], [test.name UTF8String]);
|
||||
if(fail){
|
||||
LSLog(@"Test Failed!");
|
||||
test.state = TestStateFailed;
|
||||
|
|
|
|||
|
|
@ -69,17 +69,20 @@ static void linphone_log_function(OrtpLogLevel lev, const char *fmt, va_list arg
|
|||
bundlePath = [[NSBundle mainBundle] bundlePath];
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
documentPath = [paths objectAtIndex:0];
|
||||
liblinphone_tester_init();
|
||||
liblinphone_tester_set_fileprefix([bundlePath UTF8String]);
|
||||
liblinphone_tester_set_writable_dir_prefix( ms_strdup([documentPath UTF8String]) );
|
||||
|
||||
liblinphone_tester_add_suites();
|
||||
|
||||
bc_tester_init((void (*)(int, const char *fm, va_list))linphone_log_function, ORTP_MESSAGE, ORTP_ERROR);
|
||||
bc_tester_read_dir_prefix = [bundlePath UTF8String];
|
||||
bc_tester_writable_dir_prefix = [documentPath UTF8String];
|
||||
|
||||
LSLog(@"Bundle path: %@", bundlePath);
|
||||
LSLog(@"Document path: %@", documentPath);
|
||||
|
||||
int count = liblinphone_tester_nb_test_suites();
|
||||
int count = bc_tester_nb_suites();
|
||||
_objects = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
for (int i=0; i<count; i++) {
|
||||
const char* suite = liblinphone_tester_test_suite_name(i);
|
||||
const char* suite = bc_tester_suite_name(i);
|
||||
[_objects addObject:[NSString stringWithUTF8String:suite]];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ee33c10a6826476c8a37fb20990c262a8aece799
|
||||
Subproject commit acf3bb287db8c5eeadaf4dc6d11b6eb76b40019a
|
||||
Loading…
Add table
Reference in a new issue