Commit ff3ff7ae authored by Simon Morlat's avatar Simon Morlat

fix logs and ipv6 enablement in tester.

parent 268de5e7
......@@ -7727,15 +7727,15 @@ const char * linphone_core_get_video_preset(const LinphoneCore *lc) {
#ifdef ANDROID
static int linphone_core_call_void_method(jobject obj, jmethodID id) {
JNIEnv *env=ms_get_jni_env();
if (env && obj) {
(*env)->CallVoidMethod(env,obj,id);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionClear(env);
return -1;
} else
return 0;
} else
if (env && obj) {
(*env)->CallVoidMethod(env,obj,id);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionClear(env);
return -1;
} else
return 0;
} else
return -1;
}
void linphone_core_wifi_lock_acquire(LinphoneCore *lc) {
......
......@@ -245,9 +245,12 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
void linphone_core_manager_check_accounts(LinphoneCoreManager *m){
const bctbx_list_t *it;
AccountManager *am=account_manager_get();
int logmask = ortp_get_log_level_mask(NULL);
if (!liblinphonetester_show_account_manager_logs) linphone_core_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)it->data;
account_manager_check_account(am,cfg,m->phone_alias);
}
if (!liblinphonetester_show_account_manager_logs) linphone_core_set_log_level_mask(logmask);
}
......@@ -4853,9 +4853,6 @@ static void v6_call_over_nat_64(void){
if (!liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){
bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/
liblinphonetester_ipv6=TRUE;
marie = linphone_core_manager_new("marie_nat64_rc");
pauline = linphone_core_manager_new("pauline_nat64_rc");
......@@ -4872,26 +4869,22 @@ static void v6_call_over_nat_64(void){
end_call(marie,pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/
}else ms_warning("Test skipped, no ipv6 nat64 available");
}
static void call_with_ice_in_ipv4_with_v6_enabled(void) {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){
bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/
liblinphonetester_ipv6=TRUE;
marie = linphone_core_manager_new("marie_v4proxy_rc");
pauline = linphone_core_manager_new("pauline_v4proxy_rc");
_call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/
} else ms_warning("Test skipped, need both ipv6 and v4 available");
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){
marie = linphone_core_manager_new("marie_v4proxy_rc");
pauline = linphone_core_manager_new("pauline_v4proxy_rc");
_call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
} else ms_warning("Test skipped, need both ipv6 and v4 available");
}
test_t call_tests[] = {
......
......@@ -213,7 +213,8 @@ static const char* liblinphone_helper =
"\t\t\t--keep-recorded-files\n"
"\t\t\t--disable-leak-detector\n"
"\t\t\t--disable-tls-support\n"
"\t\t\t--6\n"
"\t\t\t--no-ipv6 (turn off IPv6 in LinphoneCore, tests requiring IPv6 will be skipped)\n"
"\t\t\t--show-account-manager-logs (show temporary test account creation logs)\n"
;
int main (int argc, char *argv[])
......@@ -255,8 +256,10 @@ int main (int argc, char *argv[])
liblinphone_tester_disable_leak_detector(TRUE);
} else if (strcmp(argv[i],"--disable-tls-support")==0){
liblinphone_tester_tls_support_disabled = TRUE;
} else if (strcmp(argv[i],"--6")==0){
liblinphonetester_ipv6=TRUE;
} else if (strcmp(argv[i],"--no-ipv6")==0){
liblinphonetester_ipv6 = FALSE;
} else if (strcmp(argv[i],"--show-account-manager-logs")==0){
liblinphonetester_show_account_manager_logs=TRUE;
} else {
int bret = bc_tester_parse_args(argc, argv, i);
if (bret>0) {
......
......@@ -114,6 +114,7 @@ extern bool_t liblinphone_tester_tls_support_disabled;
extern const MSAudioDiffParams audio_cmp_params;
extern const char *liblinphone_tester_mire_id;
extern bool_t liblinphonetester_ipv6;
extern bool_t liblinphonetester_show_account_manager_logs;
typedef struct _stats {
int number_of_LinphoneRegistrationNone;
......
......@@ -56,7 +56,8 @@ const char* test_username="liblinphone_tester";
const char* test_password="secret";
const char* test_route="sip2.linphone.org";
const char *userhostsfile = "tester_hosts";
bool_t liblinphonetester_ipv6 = FALSE;
bool_t liblinphonetester_ipv6 = TRUE;
bool_t liblinphonetester_show_account_manager_logs = FALSE;
const char *liblinphone_tester_mire_id="Mire: Mire (synthetic moving picture)";
......@@ -402,12 +403,10 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
}
LinphoneCoreManager* linphone_core_manager_new3(const char* rc_file, int check_for_proxies, const char* phone_alias) {
int old_log_level = ortp_get_log_level_mask(NULL);
LinphoneCoreManager *manager = ms_new0(LinphoneCoreManager, 1);
linphone_core_set_log_level(ORTP_ERROR);
linphone_core_manager_init(manager, rc_file, phone_alias);
linphone_core_manager_start(manager, check_for_proxies);
linphone_core_set_log_level(old_log_level);
return manager;
}
......@@ -476,19 +475,21 @@ void linphone_core_manager_destroy(LinphoneCoreManager* mgr) {
}
int liblinphone_tester_ipv6_available(void){
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_INET6,SOCK_STREAM,"2a01:e00::2",53);
if (ai){
struct sockaddr_storage ss;
struct addrinfo src;
socklen_t slen=sizeof(ss);
char localip[128];
int port=0;
belle_sip_get_src_addr_for(ai->ai_addr,(socklen_t)ai->ai_addrlen,(struct sockaddr*) &ss,&slen,4444);
src.ai_addr=(struct sockaddr*) &ss;
src.ai_addrlen=slen;
bctbx_addrinfo_to_ip_address(&src,localip, sizeof(localip),&port);
freeaddrinfo(ai);
return strcmp(localip,"::1")!=0;
if (liblinphonetester_ipv6) {
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_INET6,SOCK_STREAM,"2a01:e00::2",53);
if (ai){
struct sockaddr_storage ss;
struct addrinfo src;
socklen_t slen=sizeof(ss);
char localip[128];
int port=0;
belle_sip_get_src_addr_for(ai->ai_addr,(socklen_t)ai->ai_addrlen,(struct sockaddr*) &ss,&slen,4444);
src.ai_addr=(struct sockaddr*) &ss;
src.ai_addrlen=slen;
bctbx_addrinfo_to_ip_address(&src,localip, sizeof(localip),&port);
freeaddrinfo(ai);
return strcmp(localip,"::1")!=0;
}
}
return FALSE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment