From d3d0ea518d6929d1c330f6ee5d98e09c849ea307 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Thu, 29 Nov 2018 11:55:56 +0100 Subject: [PATCH] set correct configurations for test --- LiblinphoneTester/MasterView.m | 26 ++++---------------------- LiblinphoneTester/main.m | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/LiblinphoneTester/MasterView.m b/LiblinphoneTester/MasterView.m index f12532d63..388c16f29 100644 --- a/LiblinphoneTester/MasterView.m +++ b/LiblinphoneTester/MasterView.m @@ -31,31 +31,22 @@ [super awakeFromNib]; } -- (void)setupLogging { - [Log enableLogs:ORTP_DEBUG]; - linphone_core_enable_log_collection(YES); -} - -void tester_logs_handler(int level, const char *fmt, va_list args) { - linphone_iphone_log_handler("Tester", level, fmt, args); -} - - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.detailViewController = (DetailTableView *)[[self.splitViewController.viewControllers lastObject] topViewController]; - //[self setupLogging]; + liblinphone_tester_init(NULL); + [Log enableLogs:ORTP_DEBUG]; liblinphone_tester_keep_accounts(TRUE); bundlePath = [[NSBundle mainBundle] bundlePath]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); writablePath = [paths objectAtIndex:0]; - liblinphone_tester_init(NULL); + // bc_tester_init(tester_logs_handler, ORTP_MESSAGE, ORTP_ERROR, "rcfiles"); // liblinphone_tester_add_suites(); - linphone_core_set_log_level_mask((OrtpLogLevel)(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL)); bc_tester_set_resource_dir_prefix([bundlePath UTF8String]); bc_tester_set_writable_dir_prefix([writablePath UTF8String]); @@ -63,16 +54,7 @@ void tester_logs_handler(int level, const char *fmt, va_list args) { LOGI(@"Bundle path: %@", bundlePath); LOGI(@"Writable path: %@", writablePath); -#if TARGET_OS_SIMULATOR - char *xmlFile = bc_tester_file("LibLinphoneIOS.xml"); - char *args[] = {"--xml-file", xmlFile}; - bc_tester_parse_args(2, args, 0); - - char *logFile = bc_tester_file("LibLinphoneIOS.txt"); - liblinphone_tester_set_log_file(logFile); -#endif - - liblinphonetester_ipv6 = true; + //liblinphonetester_ipv6 = true; int count = bc_tester_nb_suites(); _objects = [[NSMutableArray alloc] initWithCapacity:count + 1]; diff --git a/LiblinphoneTester/main.m b/LiblinphoneTester/main.m index 8c5f1d3d6..857c258f0 100644 --- a/LiblinphoneTester/main.m +++ b/LiblinphoneTester/main.m @@ -8,6 +8,9 @@ #import #import "AppDelegate.h" +#import "Log.h" +#import +#include "linphonetester/liblinphone_tester.h" #ifdef DEBUG @@ -24,6 +27,23 @@ int main(int argc, char *argv[]) { #ifdef DEBUG NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); #endif + int i; + for(i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--verbose") == 0) { + linphone_core_set_log_level(ORTP_MESSAGE); + } else if (strcmp(argv[i],"--log-file")==0){ +#if TARGET_OS_SIMULATOR + char *xmlFile = bc_tester_file("LibLinphoneIOS.xml"); + char *args[] = {"--xml-file", xmlFile}; + bc_tester_parse_args(2, args, 0); + + char *logFile = bc_tester_file("LibLinphoneIOS.txt"); + liblinphone_tester_set_log_file(logFile); +#endif + } else if (strcmp(argv[i],"--no-ipv6")==0){ + liblinphonetester_ipv6 = FALSE; + } + } @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }