int main (int argc, char *argv[]) { int i; int ret; const char *root_ca_path = NULL; const char *env_domain=getenv("TEST_DOMAIN"); belle_sip_tester_init(NULL); #ifndef WIN32 /*this hack doesn't work for argv[0]="c:\blablab\"*/ // this allows to launch liblinphone_tester from outside of tester directory if (strstr(argv[0], ".libs")) { int prefix_length = strstr(argv[0], ".libs") - argv[0] + 1; char *prefix = belle_sip_strdup_printf("%s%.*s", argv[0][0] == '/' ? "" : "./", prefix_length, argv[0]); // printf("Resource prefix set to %s\n", prefix); bc_tester_set_resource_dir_prefix(prefix); bc_tester_set_writable_dir_prefix(prefix); belle_sip_free(prefix); } #endif if (env_domain) { test_domain=env_domain; } for(i=1;i<argc;++i){ if (strcmp(argv[i],"--verbose")==0){ belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG); } else if (strcmp(argv[i],"--silent")==0){ belle_sip_set_log_level(BELLE_SIP_LOG_FATAL); } else if (strcmp(argv[i],"--log-file")==0){ CHECK_ARG("--log-file", ++i, argc); if (belle_sip_tester_set_log_file(argv[i]) < 0) return -2; } else if (strcmp(argv[i],"--domain")==0){ CHECK_ARG("--domain", ++i, argc); test_domain=argv[i]; }else if (strcmp(argv[i],"--auth-domain")==0){ CHECK_ARG("--auth-domain", ++i, argc); auth_domain=argv[i]; } else if (strcmp(argv[i], "--root-ca") == 0) { CHECK_ARG("--root-ca", ++i, argc); root_ca_path = argv[i]; }else { int ret = bc_tester_parse_args(argc, argv, i); if (ret>0) { i += ret - 1; continue; } else if (ret<0) { bc_tester_helper(argv[0], belle_sip_helper); } return ret; } } belle_sip_tester_set_root_ca_path(root_ca_path); pool=belle_sip_object_pool_push(); ret = bc_tester_start(argv[0]); belle_sip_tester_uninit(); return ret; }
int main (int argc, char *argv[]) { int i; int ret; const char *root_ca_path = NULL; const char *env_domain=getenv("TEST_DOMAIN"); belle_sip_tester_init(); if (env_domain) { test_domain=env_domain; } for(i=1;i<argc;++i){ if (strcmp(argv[i],"--verbose")==0){ belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG); } else if (strcmp(argv[i],"--silent")==0){ belle_sip_set_log_level(BELLE_SIP_LOG_FATAL); } else if (strcmp(argv[i],"--log-file")==0){ CHECK_ARG("--log-file", ++i, argc); log_file=fopen(argv[i],"w"); if (!log_file) { belle_sip_error("Cannot open file [%s] for writing logs because [%s]",argv[i],strerror(errno)); return -2; } else { belle_sip_message("Redirecting traces to file [%s]",argv[i]); belle_sip_set_log_file(log_file); } } else if (strcmp(argv[i],"--domain")==0){ CHECK_ARG("--domain", ++i, argc); test_domain=argv[i]; }else if (strcmp(argv[i],"--auth-domain")==0){ CHECK_ARG("--auth-domain", ++i, argc); auth_domain=argv[i]; } else if (strcmp(argv[i], "--root-ca") == 0) { CHECK_ARG("--root-ca", ++i, argc); root_ca_path = argv[i]; }else { int ret = bc_tester_parse_args(argc, argv, i); if (ret>0) { i += ret - 1; continue; } else if (ret<0) { bc_tester_helper(argv[0], belle_sip_helper); } return ret; } } belle_sip_tester_set_root_ca_path(root_ca_path); pool=belle_sip_object_pool_push(); ret = bc_tester_start(); belle_sip_tester_uninit(); return ret; }