mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 09:09:21 +00:00
Merge branch 'master' into dev_vcard
Conflicts: tester/Makefile.am
This commit is contained in:
commit
5cd1775ed3
32 changed files with 320 additions and 1325 deletions
|
|
@ -108,20 +108,6 @@ else()
|
|||
endif()
|
||||
find_package(XML2 REQUIRED)
|
||||
find_package(Zlib)
|
||||
if(ENABLE_UNIT_TESTS)
|
||||
find_package(CUnit)
|
||||
if(CUNIT_FOUND)
|
||||
cmake_push_check_state(RESET)
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS})
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES})
|
||||
check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE)
|
||||
check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES)
|
||||
cmake_pop_check_state()
|
||||
else()
|
||||
message(WARNING "Could not find the cunit library!")
|
||||
set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_TUNNEL)
|
||||
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
|
||||
include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake")
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
############################################################################
|
||||
# FindCUnit.txt
|
||||
# Copyright (C) 2015 Belledonne Communications, Grenoble France
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# - Find the CUnit include file and library
|
||||
#
|
||||
# CUNIT_FOUND - system has CUnit
|
||||
# CUNIT_INCLUDE_DIRS - the CUnit include directory
|
||||
# CUNIT_LIBRARIES - The libraries needed to use CUnit
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
set(_CUNIT_ROOT_PATHS
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
find_path(CUNIT_INCLUDE_DIRS
|
||||
NAMES CUnit/CUnit.h
|
||||
HINTS _CUNIT_ROOT_PATHS
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
if(CUNIT_INCLUDE_DIRS)
|
||||
set(HAVE_CUNIT_CUNIT_H 1)
|
||||
endif()
|
||||
|
||||
find_library(CUNIT_LIBRARIES
|
||||
NAMES cunit
|
||||
HINTS ${_CUNIT_ROOT_PATHS}
|
||||
PATH_SUFFIXES bin lib
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CUnit
|
||||
DEFAULT_MSG
|
||||
CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES)
|
||||
|
|
@ -478,6 +478,8 @@ Sal * sal_init(MSFactory *factory){
|
|||
sal->user_agent=belle_sip_header_user_agent_new();
|
||||
#if defined(PACKAGE_NAME) && defined(LIBLINPHONE_VERSION)
|
||||
belle_sip_header_user_agent_add_product(sal->user_agent, PACKAGE_NAME "/" LIBLINPHONE_VERSION);
|
||||
#else
|
||||
belle_sip_header_user_agent_add_product(sal->user_agent, "Unknown");
|
||||
#endif
|
||||
sal_append_stack_string_to_user_agent(sal);
|
||||
belle_sip_object_ref(sal->user_agent);
|
||||
|
|
@ -835,7 +837,7 @@ int sal_get_transport_timeout(const Sal* sal) {
|
|||
|
||||
void sal_set_dns_servers(Sal *sal, const MSList *servers){
|
||||
belle_sip_list_t *l = NULL;
|
||||
|
||||
|
||||
/*we have to convert the MSList into a belle_sip_list_t first*/
|
||||
for (; servers != NULL; servers = servers->next){
|
||||
l = belle_sip_list_append(l, servers->data);
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ static void subscribe_process_request_event(void *op_base, const belle_sip_reque
|
|||
ms_warning("No event header in incoming SUBSCRIBE.");
|
||||
resp=sal_op_create_response_from_request(op,req,400);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
if (!op->dialog) sal_op_release(op);
|
||||
return;
|
||||
}
|
||||
if (op->event==NULL) {
|
||||
|
|
@ -142,7 +143,13 @@ static void subscribe_process_request_event(void *op_base, const belle_sip_reque
|
|||
|
||||
if (!op->dialog) {
|
||||
if (strcmp(method,"SUBSCRIBE")==0){
|
||||
op->dialog=belle_sip_provider_create_dialog(op->base.root->prov,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
op->dialog = belle_sip_provider_create_dialog(op->base.root->prov,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
if (!op->dialog){
|
||||
resp=sal_op_create_response_from_request(op,req,481);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
sal_op_release(op);
|
||||
return;
|
||||
}
|
||||
belle_sip_dialog_set_application_data(op->dialog, sal_op_ref(op));
|
||||
ms_message("new incoming subscription from [%s] to [%s]",sal_op_get_from(op),sal_op_get_to(op));
|
||||
}else{ /*this is a NOTIFY*/
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ int sal_message_send(SalOp *op, const char *from, const char *to, const char* co
|
|||
belle_sip_request_t* req;
|
||||
char content_type_raw[256];
|
||||
size_t content_length = msg?strlen(msg):0;
|
||||
time_t curtime=time(NULL);
|
||||
time_t curtime = ms_time(NULL);
|
||||
uint8_t *multipartEncryptedMessage = NULL;
|
||||
const char *body;
|
||||
int retval;
|
||||
|
|
|
|||
|
|
@ -254,6 +254,12 @@ static void presence_process_request_event(void *op_base, const belle_sip_reques
|
|||
if (!op->dialog) {
|
||||
if (strcmp(method,"SUBSCRIBE")==0){
|
||||
belle_sip_dialog_t *dialog = belle_sip_provider_create_dialog(op->base.root->prov,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
if (!op->dialog){
|
||||
resp=sal_op_create_response_from_request(op,req,481);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
sal_op_release(op);
|
||||
return;
|
||||
}
|
||||
set_or_update_dialog(op, dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",sal_op_get_from(op),sal_op_get_to(op));
|
||||
}else{ /* this is a NOTIFY */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ public:
|
|||
bool operator==(const Participant &src) const;
|
||||
const LinphoneAddress *getUri() const {return m_uri;}
|
||||
LinphoneCall *getCall() const {return m_call;}
|
||||
void setCall(LinphoneCall *call) {m_call = call;}
|
||||
|
||||
private:
|
||||
LinphoneAddress *m_uri;
|
||||
|
|
@ -222,7 +221,6 @@ Conference::Params::Params(const LinphoneCore *core): m_enableVideo(false) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
Conference::Conference(LinphoneCore *core, const Conference::Params *params):
|
||||
m_core(core),
|
||||
m_localParticipantStream(NULL),
|
||||
|
|
|
|||
|
|
@ -609,12 +609,12 @@ static int prepare_log_collection_file_to_upload(const char *filename) {
|
|||
ortp_mutex_lock(&liblinphone_log_collection_mutex);
|
||||
output_filename = ms_strdup_printf("%s/%s",
|
||||
liblinphone_log_collection_path ? liblinphone_log_collection_path : LOG_COLLECTION_DEFAULT_PATH, filename);
|
||||
output_file = COMPRESS_OPEN(output_filename, "w");
|
||||
output_file = COMPRESS_OPEN(output_filename, "wb");
|
||||
if (output_file == NULL) goto error;
|
||||
input_filename = ms_strdup_printf("%s/%s1.log",
|
||||
liblinphone_log_collection_path ? liblinphone_log_collection_path : LOG_COLLECTION_DEFAULT_PATH,
|
||||
liblinphone_log_collection_prefix ? liblinphone_log_collection_prefix : LOG_COLLECTION_DEFAULT_PREFIX);
|
||||
input_file = fopen(input_filename, "r");
|
||||
input_file = fopen(input_filename, "rb");
|
||||
if (input_file == NULL) goto error;
|
||||
ret = compress_file(input_file, output_file);
|
||||
if (ret <= 0) goto error;
|
||||
|
|
@ -623,7 +623,7 @@ static int prepare_log_collection_file_to_upload(const char *filename) {
|
|||
input_filename = ms_strdup_printf("%s/%s2.log",
|
||||
liblinphone_log_collection_path ? liblinphone_log_collection_path : LOG_COLLECTION_DEFAULT_PATH,
|
||||
liblinphone_log_collection_prefix ? liblinphone_log_collection_prefix : LOG_COLLECTION_DEFAULT_PREFIX);
|
||||
input_file = fopen(input_filename, "r");
|
||||
input_file = fopen(input_filename, "rb");
|
||||
if (input_file != NULL) {
|
||||
ret = compress_file(input_file, output_file);
|
||||
if (ret <= 0) goto error;
|
||||
|
|
@ -671,9 +671,10 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
|
|||
COMPRESSED_LOG_COLLECTION_EXTENSION);
|
||||
linphone_content_set_name(core->log_collection_upload_information, name);
|
||||
if (prepare_log_collection_file_to_upload(name) <= 0) {
|
||||
linphone_content_unref(core->log_collection_upload_information);
|
||||
linphone_content_unref(core->log_collection_upload_information);
|
||||
core->log_collection_upload_information = NULL;
|
||||
return;
|
||||
ms_error("prepare_log_collection_file_to_upload(): error.");
|
||||
return;
|
||||
}
|
||||
linphone_content_set_size(core->log_collection_upload_information, get_size_of_file_to_upload(name));
|
||||
uri = belle_generic_uri_parse(linphone_core_get_log_collection_upload_server_url(core));
|
||||
|
|
@ -684,6 +685,9 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
|
|||
l = belle_http_request_listener_create_from_callbacks(&cbs, core);
|
||||
belle_http_provider_send_request(core->http_provider, req, l);
|
||||
ms_free(name);
|
||||
} else {
|
||||
ms_warning("Could not upload log collection: log_collection_upload_information=%p, server_url=%s, log_collection_state=%d",
|
||||
core->log_collection_upload_information, linphone_core_get_log_collection_upload_server_url(core), liblinphone_log_collection_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3184,22 +3188,27 @@ void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *d
|
|||
sal_op_cnx_ip_to_0000_if_sendonly_enable(op,lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
|
||||
}
|
||||
|
||||
LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params)
|
||||
{
|
||||
LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params){
|
||||
const char *from=NULL;
|
||||
LinphoneProxyConfig *proxy=NULL;
|
||||
LinphoneAddress *parsed_url2=NULL;
|
||||
char *real_url=NULL;
|
||||
LinphoneCall *call;
|
||||
bool_t defer = FALSE;
|
||||
LinphoneCallParams *cp = linphone_call_params_copy(params);
|
||||
LinphoneCallParams *cp;
|
||||
|
||||
linphone_core_preempt_sound_resources(lc);
|
||||
if (!(!linphone_call_params_audio_enabled(params) || linphone_call_params_get_audio_direction(params) == LinphoneMediaDirectionInactive)
|
||||
&& linphone_core_preempt_sound_resources(lc) == -1){
|
||||
ms_error("linphone_core_invite_address_with_params(): sound is required for this call but another call is already locking the sound resource. Call attempt is rejected.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!linphone_core_can_we_add_call(lc)){
|
||||
linphone_core_notify_display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cp = linphone_call_params_copy(params);
|
||||
|
||||
real_url=linphone_address_as_string(addr);
|
||||
proxy=linphone_core_lookup_known_proxy(lc,addr);
|
||||
|
|
@ -4118,22 +4127,24 @@ int linphone_core_pause_all_calls(LinphoneCore *lc){
|
|||
return 0;
|
||||
}
|
||||
|
||||
void linphone_core_preempt_sound_resources(LinphoneCore *lc){
|
||||
int linphone_core_preempt_sound_resources(LinphoneCore *lc){
|
||||
LinphoneCall *current_call;
|
||||
int err = 0;
|
||||
|
||||
if (linphone_core_is_in_conference(lc)){
|
||||
linphone_core_leave_conference(lc);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
current_call=linphone_core_get_current_call(lc);
|
||||
if(current_call != NULL){
|
||||
ms_message("Pausing automatically the current call.");
|
||||
_linphone_core_pause_call(lc,current_call);
|
||||
err = _linphone_core_pause_call(lc,current_call);
|
||||
}
|
||||
if (lc->ringstream){
|
||||
linphone_core_stop_ringing(lc);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1085,7 +1085,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
|
|||
void linphone_call_set_broken(LinphoneCall *call);
|
||||
void linphone_call_repair_if_broken(LinphoneCall *call);
|
||||
void linphone_core_repair_calls(LinphoneCore *lc);
|
||||
void linphone_core_preempt_sound_resources(LinphoneCore *lc);
|
||||
int linphone_core_preempt_sound_resources(LinphoneCore *lc);
|
||||
int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
|
||||
/*conferencing subsystem*/
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_log_scroll_to_end" swapped="no"/>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -216,7 +216,6 @@ void linphone_gtk_create_log_window(void){
|
|||
/*prevent the log window from being destroyed*/
|
||||
g_signal_connect (G_OBJECT (log_window), "delete-event",
|
||||
G_CALLBACK (gtk_widget_hide_on_delete), log_window);
|
||||
|
||||
}
|
||||
|
||||
void linphone_gtk_destroy_log_window(void){
|
||||
|
|
@ -292,11 +291,12 @@ static void stick_to_end(GtkTextView *v){
|
|||
gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,1.0,0);
|
||||
}
|
||||
|
||||
void linphone_gtk_log_scroll_to_end(GtkToggleButton *button){
|
||||
void linphone_gtk_log_scroll_to_end(GtkToggleButton *button) {
|
||||
if (gtk_toggle_button_get_active(button)){
|
||||
GtkTextView *v=GTK_TEXT_VIEW(linphone_gtk_get_widget(log_window,"textview"));
|
||||
stick_to_end(v);
|
||||
}
|
||||
lp_config_set_int(linphone_core_get_config(linphone_gtk_get_core()), "GtkUi", "logs_scroll_to_end", gtk_toggle_button_get_active(button) ? 1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -316,8 +316,10 @@ gboolean linphone_gtk_check_logs(void){
|
|||
if (log_queue) g_list_free(log_queue);
|
||||
log_queue=NULL;
|
||||
g_static_mutex_unlock(&log_mutex);
|
||||
if (v)
|
||||
if (v) {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(log_window,"scroll_to_end")), lp_config_get_int(linphone_core_get_config(linphone_gtk_get_core()), "GtkUi", "logs_scroll_to_end", 0) == 1);
|
||||
linphone_gtk_log_scroll_to_end(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(log_window,"scroll_to_end")));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,13 +186,13 @@
|
|||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">default</col>
|
||||
<col id="0" translatable="no">default</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">high-fps</col>
|
||||
<col id="0" translatable="no">high-fps</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">custom</col>
|
||||
<col id="0" translatable="no">custom</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ void linphone_gtk_video_preset_changed(GtkWidget *w) {
|
|||
gtk_widget_set_sensitive(GTK_WIDGET(framerate), FALSE);
|
||||
} else if (g_strcmp0(sel, "high-fps") == 0) {
|
||||
linphone_core_set_video_preset(lc, "high-fps");
|
||||
gtk_spin_button_set_value(framerate, 0);
|
||||
gtk_spin_button_set_value(framerate, 30);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(framerate), FALSE);
|
||||
} else if (g_strcmp0(sel, "custom") == 0) {
|
||||
linphone_core_set_video_preset(lc, "custom");
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 685beb165ee050e38ea33eb0e4a1d6a87f7b5520
|
||||
Subproject commit b0fa19899afe3a30ab85f74cc6711207934cd57d
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
############################################################################
|
||||
|
||||
set(SOURCE_FILES
|
||||
common/bc_tester_utils.c
|
||||
accountmanager.c
|
||||
call_tester.c
|
||||
complex_sip_call_tester.c
|
||||
|
|
@ -64,29 +63,28 @@ add_definitions(-DBC_CONFIG_FILE="config.h")
|
|||
|
||||
if(IOS)
|
||||
add_library(linphonetester STATIC ${SOURCE_FILES})
|
||||
target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
|
||||
target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
|
||||
target_link_libraries(linphonetester linphone ${BCTOOLBOX_LIBRARIES})
|
||||
install(TARGETS linphonetester
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
install(FILES "liblinphone_tester.h" "common/bc_tester_utils.h"
|
||||
install(FILES "liblinphone_tester.h"
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
add_library(linphone_tester_static STATIC ${SOURCE_FILES})
|
||||
target_include_directories(linphone_tester_static PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(linphone_tester_static linphone ${CUNIT_LIBRARIES})
|
||||
target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
|
||||
target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_LIBRARIES})
|
||||
|
||||
set(RUNTIME_COMPONENT_SOURCES
|
||||
liblinphone_tester_windows.cpp
|
||||
liblinphone_tester_windows.h
|
||||
)
|
||||
add_library(linphone_tester_runtime MODULE ${RUNTIME_COMPONENT_SOURCES})
|
||||
target_include_directories(linphone_tester_runtime PRIVATE common)
|
||||
target_compile_options(linphone_tester_runtime PRIVATE "/wd4996")
|
||||
target_link_libraries(linphone_tester_runtime linphone_tester_static)
|
||||
set_target_properties(linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
|
||||
|
|
@ -109,8 +107,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|||
else()
|
||||
add_executable(liblinphone_tester ${SOURCE_FILES})
|
||||
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
|
||||
target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_INCLUDE_DIRS})
|
||||
target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_LIBRARIES})
|
||||
if (GTK2_FOUND)
|
||||
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ EXTRA_DIST = tester_hosts\
|
|||
$(SIPP_FILES)\
|
||||
$(CERTIFICATE_FILES)\
|
||||
$(RCFILES)\
|
||||
$(IMAGE_FILES)\
|
||||
$(COMMON_FILE)
|
||||
$(IMAGE_FILES)
|
||||
|
||||
|
||||
|
||||
|
|
@ -141,7 +140,6 @@ liblinphonetester_la_SOURCES = \
|
|||
common/bc_tester_utils.c
|
||||
|
||||
liblinphonetester_ladir = $(includedir)/linphone
|
||||
liblinphonetester_la_HEADERS = common/bc_tester_utils.h
|
||||
|
||||
liblinphonetester_la_LDFLAGS= -no-undefined
|
||||
liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(CUNIT_LIBS)
|
||||
|
|
|
|||
|
|
@ -675,17 +675,19 @@ static void multiple_answers_call_with_media_relay(void) {
|
|||
BC_ASSERT_PTR_NOT_NULL_FATAL(call2);
|
||||
|
||||
BC_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0, int, "%d");
|
||||
ms_sleep(1); /*sleep to make sure that the 200OK of marie1 reaches the server first*/
|
||||
BC_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0, int, "%d");
|
||||
|
||||
BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) );
|
||||
BC_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 2000) );
|
||||
BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 2000) );
|
||||
/*the server will send a bye to marie2, as is 200Ok arrived second*/
|
||||
BC_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 4000) );
|
||||
|
||||
end_call(marie1, pauline);
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie1);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_with_specified_codec_bitrate(void) {
|
||||
|
|
@ -1142,9 +1144,6 @@ static void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManag
|
|||
}
|
||||
|
||||
static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) {
|
||||
// Force STUN server resolution to prevent DNS resolution issues on some machines
|
||||
linphone_core_get_stun_server_addrinfo(pauline->lc);
|
||||
linphone_core_get_stun_server_addrinfo(marie->lc);
|
||||
|
||||
linphone_core_set_user_agent(pauline->lc, "Natted Linphone", NULL);
|
||||
linphone_core_set_user_agent(marie->lc, "Natted Linphone", NULL);
|
||||
|
|
@ -2503,10 +2502,6 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide
|
|||
bool_t call_ok;
|
||||
unsigned int nb_media_starts = 1;
|
||||
|
||||
/*force resolution of stun server before starting the test*/
|
||||
linphone_core_get_stun_server_addrinfo(pauline->lc);
|
||||
linphone_core_get_stun_server_addrinfo(marie->lc);
|
||||
|
||||
linphone_core_set_video_policy(pauline->lc, &caller_policy);
|
||||
linphone_core_set_video_policy(marie->lc, &callee_policy);
|
||||
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
|
||||
|
|
@ -2597,10 +2592,6 @@ static void call_with_ice_video_and_rtt(void) {
|
|||
LinphoneCallParams *params = NULL;
|
||||
LinphoneCall *marie_call = NULL;
|
||||
|
||||
/*force resolution of stun server before starting the test*/
|
||||
linphone_core_get_stun_server_addrinfo(pauline->lc);
|
||||
linphone_core_get_stun_server_addrinfo(marie->lc);
|
||||
|
||||
linphone_core_set_video_policy(pauline->lc, &policy);
|
||||
linphone_core_set_video_policy(marie->lc, &policy);
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
|
|
@ -5830,7 +5821,11 @@ static void call_logs_sqlite_storage(void) {
|
|||
|
||||
call_id = linphone_call_log_get_call_id(call_log);
|
||||
BC_ASSERT_PTR_NOT_NULL(call_id);
|
||||
BC_ASSERT_PTR_NOT_NULL(linphone_core_find_call_log_from_call_id(marie->lc, call_id));
|
||||
{
|
||||
LinphoneCallLog* find_call_log = linphone_core_find_call_log_from_call_id(marie->lc, call_id);
|
||||
BC_ASSERT_PTR_NOT_NULL(find_call_log);
|
||||
if (find_call_log) linphone_call_log_unref(find_call_log);
|
||||
}
|
||||
|
||||
BC_ASSERT_TRUE(linphone_address_equal(
|
||||
linphone_call_log_get_remote_address(call_log),
|
||||
|
|
@ -6036,7 +6031,7 @@ test_t call_tests[] = {
|
|||
TEST_NO_TAG("Cancelled ringing call", cancelled_ringing_call),
|
||||
TEST_NO_TAG("Call busy when calling self", call_busy_when_calling_self),
|
||||
TEST_NO_TAG("Simple call", simple_call),
|
||||
TEST_NO_TAG("Call terminated automatically by linphone_core_destroy", automatic_call_termination),
|
||||
TEST_ONE_TAG("Call terminated automatically by linphone_core_destroy", automatic_call_termination, "LeaksMemory"),
|
||||
TEST_NO_TAG("Call with http proxy", call_with_http_proxy),
|
||||
TEST_NO_TAG("Call with timeouted bye", call_with_timeouted_bye),
|
||||
TEST_NO_TAG("Direct call over IPv6", direct_call_over_ipv6),
|
||||
|
|
|
|||
|
|
@ -1,115 +0,0 @@
|
|||
# Copyright (C) 2012 Belledonne Comunications, Grenoble, France
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Created by Gautier Pelloux-Prayer on 2014/10/24.
|
||||
# This script adds auto-completion for liblinphone_tester binary for Bash and
|
||||
# Zsh. To use it, just type: `source liblinphone_completion`, then for each
|
||||
# supported exectuable (see end of file), you will get auto-completions.
|
||||
# To use it permanently, source this file in your .rc file (.bashrc or .zshrc).
|
||||
|
||||
_liblinphone_complete() {
|
||||
local completions command_requiring_argument prev_arg latest_arg available_tasks has_not_set_suite suite_name
|
||||
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
set -- "${COMP_WORDS[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
|
||||
elif [ -n "$ZSH_VERSION" ]; then
|
||||
local args
|
||||
read -cA args #read list of arguments user entered
|
||||
set -- "${args[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
|
||||
fi
|
||||
#skip program name
|
||||
program=$1
|
||||
shift
|
||||
|
||||
# if user required help, do not complete anything
|
||||
if ! grep -q -- "--help" <<< "$@"; then
|
||||
# retrieve the last argument
|
||||
latest_arg=""
|
||||
prev_arg=""
|
||||
latest_is_empty=0
|
||||
for arg in "$@"; do
|
||||
if [ ! -z "$arg" ]; then
|
||||
prev_arg="$latest_arg"
|
||||
latest_arg="$arg"
|
||||
else
|
||||
latest_is_empty=1
|
||||
fi
|
||||
done
|
||||
|
||||
# get the tasks available, from --help
|
||||
available_tasks="$($program 2>&1 --help | sed -nE "s/.*--([^ ]*).*/--\\1/p")"
|
||||
|
||||
# these commands expect an argument
|
||||
command_requiring_argument="$($program 2>&1 --help | sed -nE "s/.*--(.*) <.*/--\\1/p")"
|
||||
|
||||
# remove all already provided tasks (it's useless to provide them twice)
|
||||
if [[ ! -z "$@" ]]; then
|
||||
current_tasks=$(echo $@ | grep -Eo -- "--([^ ])*" | tr '\n' '|' | sed 's/|/$|/g')--$
|
||||
if [ ! -z "$current_tasks" ]; then
|
||||
available_tasks=$(echo "$available_tasks" | grep -vE -- "(${current_tasks})")
|
||||
fi
|
||||
fi
|
||||
# remove --test option if --suite is not provided yet!
|
||||
has_not_set_suite=$(grep -q -- "--suite" <<< "$@"; echo $?)
|
||||
if [ $has_not_set_suite = 1 ]; then
|
||||
available_tasks=$(echo "$available_tasks" | grep -v -- --test)
|
||||
fi
|
||||
|
||||
# if latest arg does not start with '--', it is a custom value
|
||||
if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then
|
||||
if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then
|
||||
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)$/\1/p' |sed "s@\\\\@@g")
|
||||
completions="$($program --list-tests $suite_name)"
|
||||
elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then
|
||||
completions="$($program --list-suites)"
|
||||
fi
|
||||
elif [ "$latest_arg" = "--test" ]; then
|
||||
# list available tests if --suite was provided
|
||||
if [ $has_not_set_suite = 0 ]; then
|
||||
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)/\1/p' |sed "s@\\\\@@g")
|
||||
completions="$($program --list-tests $suite_name)"
|
||||
fi
|
||||
elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then
|
||||
completions="$($program --list-suites)"
|
||||
# we are waiting for a custom value, so do not hint anything
|
||||
elif [[ ! -z "$latest_arg" ]] && grep -q -- "^$latest_arg$" <<< "$command_requiring_argument"; then
|
||||
completions=""
|
||||
else
|
||||
completions="$available_tasks"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$completions" ]; then
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
IFS=$'\n' #if that even necessary?
|
||||
COMPREPLY=($(compgen -W "${completions}" -- ${COMP_WORDS[COMP_CWORD]}))
|
||||
elif [ -n "$ZSH_VERSION" ]; then
|
||||
reply=( "${(ps:\n:)completions}" )
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
for tester in liblinphone_tester mediastreamer2_tester belle_sip_tester pcap_playback \
|
||||
bench mediastream msaudiocmp mtudiscover videodisplay linphone lpc2xml_test \
|
||||
lp-gen-wrappers xml2lpc_test; do
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
complete -F _liblinphone_complete $tester
|
||||
elif [ -n "$ZSH_VERSION" ]; then
|
||||
compctl -K _liblinphone_complete $tester
|
||||
else
|
||||
echo "Your shell might be not supported! Only bash and zsh tested."
|
||||
fi
|
||||
done
|
||||
|
|
@ -1,705 +0,0 @@
|
|||
/*
|
||||
tester - liblinphone test suite
|
||||
Copyright (C) 2013 Belledonne Communications SARL
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/* this must be provided at compile time*/
|
||||
#include BC_CONFIG_FILE
|
||||
|
||||
#include "bc_tester_utils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
|
||||
#pragma GCC diagnostic push
|
||||
#endif
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
|
||||
#include "CUnit/Basic.h"
|
||||
#include "CUnit/Automated.h"
|
||||
#include "CUnit/MyMem.h"
|
||||
|
||||
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(__MINGW32__) || !defined(WINAPI_FAMILY_PARTITION) || !defined(WINAPI_PARTITION_DESKTOP)
|
||||
#define BC_TESTER_WINDOWS_DESKTOP 1
|
||||
#elif defined(WINAPI_FAMILY_PARTITION)
|
||||
#if defined(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#define BC_TESTER_WINDOWS_DESKTOP 1
|
||||
#endif
|
||||
#if defined(WINAPI_PARTITION_PHONE_APP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||
#define BC_TESTER_WINDOWS_PHONE 1
|
||||
#endif
|
||||
#if defined(WINAPI_PARTITION_APP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
#define BC_TESTER_WINDOWS_UNIVERSAL 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __linux
|
||||
/*for monitoring total space allocated via malloc*/
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
static char *bc_tester_resource_dir_prefix = NULL;
|
||||
// by default writable will always write near the executable
|
||||
static char *bc_tester_writable_dir_prefix = NULL;
|
||||
|
||||
static char *bc_current_suite_name = NULL;
|
||||
static char *bc_current_test_name = NULL;
|
||||
|
||||
int bc_printf_verbosity_info;
|
||||
int bc_printf_verbosity_error;
|
||||
|
||||
static test_suite_t **test_suite = NULL;
|
||||
static int nb_test_suites = 0;
|
||||
|
||||
#ifdef HAVE_CU_CURSES
|
||||
#include "CUnit/CUCurses.h"
|
||||
static unsigned char curses = 0;
|
||||
#endif
|
||||
|
||||
char* xml_file = "CUnitAutomated-Results.xml";
|
||||
int xml_enabled = 0;
|
||||
char * suite_name = NULL;
|
||||
char * test_name = NULL;
|
||||
char * tag_name = NULL;
|
||||
static long max_vm_kb = 0;
|
||||
|
||||
void (*tester_printf_va)(int level, const char *format, va_list args);
|
||||
|
||||
void bc_tester_printf(int level, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
tester_printf_va(level, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
int bc_tester_run_suite(test_suite_t *suite, const char *tag_name) {
|
||||
int i;
|
||||
CU_pSuite pSuite;
|
||||
|
||||
if (tag_name != NULL) {
|
||||
int j;
|
||||
int nb_tests_for_tag = 0;
|
||||
for (i = 0; i < suite->nb_tests; i++) {
|
||||
for (j = 0; j < (sizeof(suite->tests[i].tags) / sizeof(suite->tests[i].tags[0])); j++) {
|
||||
if ((suite->tests[i].tags[j] != NULL) && (strcasecmp(tag_name, suite->tests[i].tags[j]) == 0)) {
|
||||
nb_tests_for_tag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nb_tests_for_tag > 0) {
|
||||
pSuite = CU_add_suite(suite->name, suite->before_all, suite->after_all);
|
||||
for (i = 0; i < suite->nb_tests; i++) {
|
||||
for (j = 0; j < (sizeof(suite->tests[i].tags) / sizeof(suite->tests[i].tags[0])); j++) {
|
||||
if ((suite->tests[i].tags[j] != NULL) && (strcasecmp(tag_name, suite->tests[i].tags[j]) == 0)) {
|
||||
if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
|
||||
return CU_get_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pSuite = CU_add_suite(suite->name, suite->before_all, suite->after_all);
|
||||
for (i = 0; i < suite->nb_tests; i++) {
|
||||
if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
|
||||
return CU_get_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * bc_tester_suite_name(int suite_index) {
|
||||
if (suite_index >= nb_test_suites) return NULL;
|
||||
return test_suite[suite_index]->name;
|
||||
}
|
||||
|
||||
int bc_tester_suite_index(const char *suite_name) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_test_suites; i++) {
|
||||
if (strcmp(suite_name, test_suite[i]->name) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int bc_tester_nb_suites(void) {
|
||||
return nb_test_suites;
|
||||
}
|
||||
|
||||
const char * bc_tester_test_name(const char *suite_name, int test_index) {
|
||||
int suite_index = bc_tester_suite_index(suite_name);
|
||||
if ((suite_index < 0) || (suite_index >= nb_test_suites)) return NULL;
|
||||
if (test_index >= test_suite[suite_index]->nb_tests) return NULL;
|
||||
return test_suite[suite_index]->tests[test_index].name;
|
||||
}
|
||||
|
||||
int bc_tester_nb_tests(const char *suite_name) {
|
||||
int i = bc_tester_suite_index(suite_name);
|
||||
if (i < 0) return 0;
|
||||
return test_suite[i]->nb_tests;
|
||||
}
|
||||
|
||||
void bc_tester_list_suites(void) {
|
||||
int j;
|
||||
for(j=0;j<nb_test_suites;j++) {
|
||||
bc_tester_printf(bc_printf_verbosity_info, "%s", bc_tester_suite_name(j));
|
||||
}
|
||||
}
|
||||
|
||||
void bc_tester_list_tests(const char *suite_name) {
|
||||
int j;
|
||||
for( j = 0; j < bc_tester_nb_tests(suite_name); j++) {
|
||||
const char *test_name = bc_tester_test_name(suite_name, j);
|
||||
bc_tester_printf(bc_printf_verbosity_info, "%s", test_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void all_complete_message_handler(const CU_pFailureRecord pFailure) {
|
||||
#ifdef HAVE_CU_GET_SUITE
|
||||
char * results = CU_get_run_results_string();
|
||||
bc_tester_printf(bc_printf_verbosity_info,"\n%s",results);
|
||||
CU_FREE(results);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void suite_init_failure_message_handler(const CU_pSuite pSuite) {
|
||||
bc_tester_printf(bc_printf_verbosity_error,"Suite initialization failed for [%s]", pSuite->pName);
|
||||
}
|
||||
|
||||
static void suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
|
||||
bc_tester_printf(bc_printf_verbosity_error,"Suite cleanup failed for [%s]", pSuite->pName);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CU_GET_SUITE
|
||||
static time_t suite_start_time = 0;
|
||||
static void suite_start_message_handler(const CU_pSuite pSuite) {
|
||||
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] started\n", pSuite->pName);
|
||||
suite_start_time = time(NULL);
|
||||
bc_current_suite_name = pSuite->pName;
|
||||
}
|
||||
static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) {
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Suite [%s] ended in %lu sec\n", pSuite->pName,
|
||||
time(NULL) - suite_start_time);
|
||||
}
|
||||
|
||||
static time_t test_start_time = 0;
|
||||
static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
|
||||
int suite_index = bc_tester_suite_index(pSuite->pName);
|
||||
if (test_suite[suite_index]->before_each) {
|
||||
test_suite[suite_index]->before_each();
|
||||
}
|
||||
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName);
|
||||
test_start_time = time(NULL);
|
||||
bc_current_test_name = pTest->pName;
|
||||
}
|
||||
|
||||
/*derivated from cunit*/
|
||||
static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite pSuite,
|
||||
const CU_pFailureRecord pFailureList) {
|
||||
int i;
|
||||
int suite_index = bc_tester_suite_index(pSuite->pName);
|
||||
CU_pFailureRecord pFailure = pFailureList;
|
||||
char *buffer = NULL;
|
||||
char* result = bc_sprintf("Suite [%s] Test [%s] %s in %lu secs", pSuite->pName, pTest->pName,
|
||||
pFailure ? "failed" : "passed", (unsigned long)(time(NULL) - test_start_time));
|
||||
|
||||
if (pFailure) {
|
||||
for (i = 1; (NULL != pFailure); pFailure = pFailure->pNext, i++) {
|
||||
buffer = bc_sprintf("%s\n %d. %s:%u - %s",
|
||||
result,
|
||||
i,
|
||||
(NULL != pFailure->strFileName) ? pFailure->strFileName : "",
|
||||
pFailure->uiLineNumber,
|
||||
(NULL != pFailure->strCondition) ? pFailure->strCondition : "");
|
||||
free(result);
|
||||
result = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
bc_tester_printf(bc_printf_verbosity_info,"%s", result);
|
||||
free(result);
|
||||
|
||||
if (test_suite[suite_index]->after_each) {
|
||||
test_suite[suite_index]->after_each();
|
||||
}
|
||||
//insert empty line
|
||||
bc_tester_printf(bc_printf_verbosity_info,"");
|
||||
|
||||
#ifdef __linux
|
||||
/* use mallinfo() to monitor allocated space. It is linux specific but other methods don't work:
|
||||
* setrlimit() RLIMIT_DATA doesn't count memory allocated via mmap() (which is used internally by malloc)
|
||||
* setrlimit() RLIMIT_AS works but also counts virtual memory allocated by thread stacks, which is very big and
|
||||
* hardly controllable.
|
||||
* setrlimit() RLIMIT_RSS does nothing interesting on linux.
|
||||
* getrusage() of RSS is unreliable: memory blocks can be leaked without being read or written, which would not
|
||||
* appear in RSS.
|
||||
* mallinfo() itself is the less worse solution. Allocated bytes are returned as 'int' so limited to 2GB
|
||||
*/
|
||||
if (max_vm_kb) {
|
||||
struct mallinfo minfo = mallinfo();
|
||||
if (minfo.uordblks > max_vm_kb * 1024) {
|
||||
bc_tester_printf(
|
||||
bc_printf_verbosity_error,
|
||||
"The program exceeded the maximum amount of memory allocatable (%i bytes), aborting now.\n",
|
||||
minfo.uordblks);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int bc_tester_run_tests(const char *suite_name, const char *test_name, const char *tag_name) {
|
||||
int i;
|
||||
|
||||
/* initialize the CUnit test registry */
|
||||
if (CUE_SUCCESS != CU_initialize_registry())
|
||||
return CU_get_error();
|
||||
|
||||
for (i = 0; i < nb_test_suites; i++) {
|
||||
bc_tester_run_suite(test_suite[i], tag_name);
|
||||
}
|
||||
#ifdef HAVE_CU_GET_SUITE
|
||||
CU_set_suite_start_handler(suite_start_message_handler);
|
||||
CU_set_suite_complete_handler(suite_complete_message_handler);
|
||||
CU_set_test_start_handler(test_start_message_handler);
|
||||
CU_set_test_complete_handler(test_complete_message_handler);
|
||||
#endif
|
||||
CU_set_all_test_complete_handler(all_complete_message_handler);
|
||||
CU_set_suite_init_failure_handler(suite_init_failure_message_handler);
|
||||
CU_set_suite_cleanup_failure_handler(suite_cleanup_failure_message_handler);
|
||||
|
||||
if( xml_enabled != 0 ){
|
||||
CU_automated_run_tests();
|
||||
} else {
|
||||
|
||||
#ifndef HAVE_CU_GET_SUITE
|
||||
if( suite_name ){
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'", suite_name);
|
||||
}
|
||||
#else
|
||||
if (suite_name){
|
||||
CU_pSuite suite;
|
||||
suite=CU_get_suite(suite_name);
|
||||
if (!suite) {
|
||||
if (tag_name != NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Could not find suite '%s' or this suite has no tests with tag '%s'. Available suites are:", suite_name, tag_name);
|
||||
} else {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Could not find suite '%s'. Available suites are:", suite_name);
|
||||
}
|
||||
bc_tester_list_suites();
|
||||
return -1;
|
||||
} else if (test_name) {
|
||||
CU_pTest test=CU_get_test_by_name(test_name, suite);
|
||||
if (!test) {
|
||||
if (tag_name != NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Could not find test '%s' in suite '%s' or this test is not tagged '%s'. Available tests are:", test_name, suite_name, tag_name);
|
||||
} else {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
|
||||
}
|
||||
// do not use suite_name here, since this method is case sensitive
|
||||
bc_tester_list_tests(suite->pName);
|
||||
return -2;
|
||||
} else {
|
||||
CU_ErrorCode err= CU_run_test(suite, test);
|
||||
if (err != CUE_SUCCESS) bc_tester_printf(bc_printf_verbosity_error, "CU_basic_run_test error %d", err);
|
||||
}
|
||||
} else {
|
||||
CU_run_suite(suite);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_CU_CURSES
|
||||
if (curses) {
|
||||
/* Run tests using the CUnit curses interface */
|
||||
CU_curses_run_tests();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Run all tests using the CUnit Basic interface */
|
||||
CU_run_all_tests();
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef __linux
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Still %i kilobytes allocated when all tests are finished.",
|
||||
mallinfo().uordblks / 1024);
|
||||
#endif
|
||||
|
||||
return CU_get_number_of_tests_failed()!=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void bc_tester_helper(const char *name, const char* additionnal_helper) {
|
||||
bc_tester_printf(bc_printf_verbosity_info,
|
||||
"%s --help\n"
|
||||
#ifdef HAVE_CU_CURSES
|
||||
"\t\t\t--curses\n"
|
||||
#endif
|
||||
"\t\t\t--list-suites\n"
|
||||
"\t\t\t--list-tests <suite>\n"
|
||||
"\t\t\t--suite <suite name>\n"
|
||||
"\t\t\t--test <test name>\n"
|
||||
"\t\t\t--resource-dir <folder path> (directory where tester resource are located)\n"
|
||||
"\t\t\t--writable-dir <folder path> (directory where temporary files should be created)\n"
|
||||
"\t\t\t--xml\n"
|
||||
"\t\t\t--xml-file <xml file name>\n"
|
||||
"\t\t\t--max-alloc <size in ko> (maximum ammount of memory obtained via malloc allocator)\n"
|
||||
"And additionally:\n"
|
||||
"%s",
|
||||
name,
|
||||
additionnal_helper);
|
||||
}
|
||||
|
||||
#if !defined(BC_TESTER_WINDOWS_PHONE) && !defined(BC_TESTER_WINDOWS_UNIVERSAL) && !defined(__QNX__) && !defined(ANDROID) && !defined(IOS)
|
||||
static int file_exists(const char* root_path) {
|
||||
char * res_path = bc_sprintf("%s/common/bc_completion", root_path);
|
||||
FILE* file = fopen(res_path, "r");
|
||||
int found = (file != NULL);
|
||||
free(res_path);
|
||||
if (file) {
|
||||
fclose(file);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void detect_res_prefix(const char* prog) {
|
||||
char* progpath = NULL;
|
||||
FILE* writable_file = NULL;
|
||||
|
||||
if (prog != NULL) {
|
||||
progpath = strdup(prog);
|
||||
if (strchr(prog, '/') != NULL) {
|
||||
progpath[strrchr(prog, '/') - prog + 1] = '\0';
|
||||
} else if (strchr(prog, '\\') != NULL) {
|
||||
progpath[strrchr(prog, '\\') - prog + 1] = '\0';
|
||||
}
|
||||
}
|
||||
#if !defined(BC_TESTER_WINDOWS_PHONE) && !defined(BC_TESTER_WINDOWS_UNIVERSAL) && !defined(__QNX__) && !defined(ANDROID) && !defined(IOS)
|
||||
{
|
||||
char* prefix = NULL;
|
||||
|
||||
if (file_exists(".")) {
|
||||
prefix = strdup(".");
|
||||
} else if (file_exists("..")) {
|
||||
prefix = strdup("..");
|
||||
} else if (progpath) {
|
||||
//for autotools, binary is in .libs/ subdirectory
|
||||
char * progpath2 = bc_sprintf("%s/../", progpath);
|
||||
if (file_exists(progpath)) {
|
||||
prefix = strdup(progpath);
|
||||
} else if (file_exists(progpath2)) {
|
||||
prefix = strdup(progpath2);
|
||||
}
|
||||
free(progpath2);
|
||||
}
|
||||
|
||||
if (bc_tester_resource_dir_prefix != NULL && !file_exists(bc_tester_resource_dir_prefix)) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Invalid provided resource directory: could not find expected resources in %s.\n", bc_tester_resource_dir_prefix);
|
||||
free(bc_tester_resource_dir_prefix);
|
||||
bc_tester_resource_dir_prefix = NULL;
|
||||
}
|
||||
|
||||
if (prefix != NULL) {
|
||||
if (bc_tester_resource_dir_prefix == NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Resource directory set to %s\n", prefix);
|
||||
bc_tester_set_resource_dir_prefix(prefix);
|
||||
}
|
||||
|
||||
if (bc_tester_writable_dir_prefix == NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Writable directory set to %s\n", prefix);
|
||||
bc_tester_set_writable_dir_prefix(prefix);
|
||||
}
|
||||
free(prefix);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check that we can write in writable directory
|
||||
if (bc_tester_writable_dir_prefix != NULL) {
|
||||
char * writable_file_path = bc_sprintf("%s/%s", bc_tester_writable_dir_prefix, ".bc_tester_utils.tmp");
|
||||
writable_file = fopen(writable_file_path, "w");
|
||||
if (writable_file) {
|
||||
fclose(writable_file);
|
||||
}
|
||||
free(writable_file_path);
|
||||
}
|
||||
if (bc_tester_resource_dir_prefix == NULL || writable_file == NULL) {
|
||||
if (bc_tester_resource_dir_prefix == NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Failed to detect resources for %s.\n", prog);
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Could not find resource directory in %s! Please try again using option --resource-dir.\n", progpath);
|
||||
}
|
||||
if (writable_file == NULL) {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Failed to write file in %s. Please try again using option --writable-dir.\n", bc_tester_writable_dir_prefix);
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
if (progpath != NULL) {
|
||||
free(progpath);
|
||||
}
|
||||
}
|
||||
|
||||
void bc_tester_init(void (*ftester_printf)(int level, const char *format, va_list args), int iverbosity_info, int iverbosity_error) {
|
||||
tester_printf_va = ftester_printf;
|
||||
bc_printf_verbosity_error = iverbosity_error;
|
||||
bc_printf_verbosity_info = iverbosity_info;
|
||||
bc_tester_writable_dir_prefix = strdup(".");
|
||||
}
|
||||
|
||||
void bc_tester_set_max_vm(long amax_vm_kb) {
|
||||
#ifdef __linux
|
||||
max_vm_kb = amax_vm_kb;
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Maximum virtual memory space set to %li kilo bytes", max_vm_kb);
|
||||
#else
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Maximum virtual memory space setting is only implemented on Linux.");
|
||||
#endif
|
||||
}
|
||||
|
||||
int bc_tester_parse_args(int argc, char **argv, int argid)
|
||||
{
|
||||
int i = argid;
|
||||
|
||||
if (strcmp(argv[i],"--help")==0){
|
||||
return -1;
|
||||
} else if (strcmp(argv[i],"--test")==0){
|
||||
CHECK_ARG("--test", ++i, argc);
|
||||
test_name=argv[i];
|
||||
} else if (strcmp(argv[i],"--suite")==0){
|
||||
CHECK_ARG("--suite", ++i, argc);
|
||||
suite_name=argv[i];
|
||||
} else if (strcmp(argv[i], "--tag") == 0) {
|
||||
CHECK_ARG("--tag", ++i, argc);
|
||||
tag_name = argv[i];
|
||||
} else if (strcmp(argv[i],"--list-suites")==0){
|
||||
bc_tester_list_suites();
|
||||
return 0;
|
||||
} else if (strcmp(argv[i],"--list-tests")==0){
|
||||
CHECK_ARG("--list-tests", ++i, argc);
|
||||
suite_name = argv[i];
|
||||
bc_tester_list_tests(suite_name);
|
||||
return 0;
|
||||
} else if (strcmp(argv[i], "--xml-file") == 0){
|
||||
CHECK_ARG("--xml-file", ++i, argc);
|
||||
xml_file = argv[i];
|
||||
xml_enabled = 1;
|
||||
} else if (strcmp(argv[i], "--xml") == 0){
|
||||
xml_enabled = 1;
|
||||
} else if (strcmp(argv[i], "--max-alloc") == 0) {
|
||||
CHECK_ARG("--max-alloc", ++i, argc);
|
||||
max_vm_kb = atol(argv[i]);
|
||||
} else if (strcmp(argv[i], "--resource-dir") == 0) {
|
||||
CHECK_ARG("--resource-dir", ++i, argc);
|
||||
bc_tester_resource_dir_prefix = strdup(argv[i]);
|
||||
} else if (strcmp(argv[i], "--writable-dir") == 0) {
|
||||
CHECK_ARG("--writable-dir", ++i, argc);
|
||||
bc_tester_writable_dir_prefix = strdup(argv[i]);
|
||||
} else {
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Unknown option \"%s\"\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( xml_enabled && (suite_name || test_name) ){
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Cannot use both XML and specific test suite\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* returns number of arguments read + 1 */
|
||||
return i - argid + 1;
|
||||
}
|
||||
|
||||
int bc_tester_start(const char* prog_name) {
|
||||
int ret;
|
||||
|
||||
detect_res_prefix(prog_name);
|
||||
|
||||
if (max_vm_kb)
|
||||
bc_tester_set_max_vm(max_vm_kb);
|
||||
|
||||
if( xml_enabled ){
|
||||
char * xml_tmp_file = bc_sprintf("%s.tmp", xml_file);
|
||||
CU_set_output_filename(xml_tmp_file);
|
||||
free(xml_tmp_file);
|
||||
}
|
||||
|
||||
ret = bc_tester_run_tests(suite_name, test_name, tag_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
void bc_tester_add_suite(test_suite_t *suite) {
|
||||
if (test_suite == NULL) {
|
||||
test_suite = (test_suite_t **)malloc(10 * sizeof(test_suite_t *));
|
||||
}
|
||||
test_suite[nb_test_suites] = suite;
|
||||
nb_test_suites++;
|
||||
if ((nb_test_suites % 10) == 0) {
|
||||
test_suite = (test_suite_t **)realloc(test_suite, (nb_test_suites + 10) * sizeof(test_suite_t *));
|
||||
}
|
||||
}
|
||||
|
||||
void bc_tester_uninit(void) {
|
||||
/* Redisplay list of failed tests on end */
|
||||
/*BUG: do not display list of failures on mingw, it crashes mysteriously*/
|
||||
#if !defined(WIN32) && !defined(_MSC_VER)
|
||||
/* Redisplay list of failed tests on end */
|
||||
if (CU_get_number_of_failure_records()){
|
||||
CU_basic_show_failures(CU_get_failure_list());
|
||||
}
|
||||
#endif
|
||||
CU_cleanup_registry();
|
||||
/*add missing final newline*/
|
||||
bc_tester_printf(bc_printf_verbosity_info,"");
|
||||
|
||||
if( xml_enabled ){
|
||||
/*create real xml file only if tester did not crash*/
|
||||
char * xml_tmp_file = bc_sprintf("%s.tmp-Results.xml", xml_file);
|
||||
rename(xml_tmp_file, xml_file);
|
||||
free(xml_tmp_file);
|
||||
}
|
||||
|
||||
if (test_suite != NULL) {
|
||||
free(test_suite);
|
||||
test_suite = NULL;
|
||||
nb_test_suites = 0;
|
||||
}
|
||||
|
||||
if (bc_tester_resource_dir_prefix != NULL) {
|
||||
free(bc_tester_resource_dir_prefix);
|
||||
bc_tester_resource_dir_prefix = NULL;
|
||||
}
|
||||
if (bc_tester_writable_dir_prefix != NULL) {
|
||||
free(bc_tester_writable_dir_prefix);
|
||||
bc_tester_writable_dir_prefix = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void bc_tester_set_dir_prefix(char **prefix, const char *name) {
|
||||
if (*prefix != NULL) free(*prefix);
|
||||
*prefix = strdup(name);
|
||||
}
|
||||
|
||||
const char * bc_tester_get_resource_dir_prefix(void) {
|
||||
return bc_tester_resource_dir_prefix;
|
||||
}
|
||||
|
||||
void bc_tester_set_resource_dir_prefix(const char *name) {
|
||||
bc_tester_set_dir_prefix(&bc_tester_resource_dir_prefix, name);
|
||||
}
|
||||
|
||||
const char * bc_tester_get_writable_dir_prefix(void) {
|
||||
return bc_tester_writable_dir_prefix;
|
||||
}
|
||||
|
||||
void bc_tester_set_writable_dir_prefix(const char *name) {
|
||||
bc_tester_set_dir_prefix(&bc_tester_writable_dir_prefix, name);
|
||||
}
|
||||
|
||||
static char * bc_tester_path(const char *prefix, const char *name) {
|
||||
if (name) {
|
||||
return bc_sprintf("%s/%s", prefix, name);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char * bc_tester_res(const char *name) {
|
||||
return bc_tester_path(bc_tester_resource_dir_prefix, name);
|
||||
}
|
||||
|
||||
char * bc_tester_file(const char *name) {
|
||||
return bc_tester_path(bc_tester_writable_dir_prefix, name);
|
||||
}
|
||||
|
||||
char* bc_sprintfva(const char* format, va_list args) {
|
||||
/* Guess we need no more than 100 bytes. */
|
||||
int n, size = 200;
|
||||
char *p,*np;
|
||||
#ifndef WIN32
|
||||
va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
|
||||
#endif
|
||||
if ((p = malloc(size)) == NULL)
|
||||
return NULL;
|
||||
while (1)
|
||||
{
|
||||
/* Try to print in the allocated space. */
|
||||
#ifndef WIN32
|
||||
va_copy(cap,args);
|
||||
n = vsnprintf (p, size, format, cap);
|
||||
va_end(cap);
|
||||
#else
|
||||
/*this works on 32 bits, luckily*/
|
||||
n = vsnprintf (p, size, format, args);
|
||||
#endif
|
||||
/* If that worked, return the string. */
|
||||
if (n > -1 && n < size)
|
||||
return p;
|
||||
//bc_tester_printf(bc_printf_verbosity_error, "Reallocing space.\n");
|
||||
/* Else try again with more space. */
|
||||
if (n > -1) /* glibc 2.1 */
|
||||
size = n + 1; /* precisely what is needed */
|
||||
else /* glibc 2.0 */
|
||||
size *= 2; /* twice the old size */
|
||||
if ((np = realloc (p, size)) == NULL)
|
||||
{
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = np;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char* bc_sprintf(const char* format, ...) {
|
||||
va_list args;
|
||||
char* res;
|
||||
va_start(args, format);
|
||||
res = bc_sprintfva(format, args);
|
||||
va_end (args);
|
||||
return res;
|
||||
}
|
||||
|
||||
void bc_free(void *ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
const char * bc_tester_current_suite_name(void) {
|
||||
return bc_current_suite_name;
|
||||
}
|
||||
|
||||
const char * bc_tester_current_test_name(void) {
|
||||
return bc_current_test_name;
|
||||
}
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
/*
|
||||
tester - liblinphone test suite
|
||||
Copyright (C) 2013 Belledonne Communications SARL
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TESTER_UTILS_H
|
||||
#define TESTER_UTILS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef snprintf
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#ifndef strdup
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern int bc_printf_verbosity_info;
|
||||
extern int bc_printf_verbosity_error;
|
||||
|
||||
typedef void (*test_function_t)(void);
|
||||
/** Function used in all suites - it is invoked before all and each tests and also after each and all tests
|
||||
* @return 0 means success, otherwise it's an error
|
||||
**/
|
||||
typedef int (*pre_post_function_t)(void);
|
||||
// typedef int (*test_suite_function_t)(const char *name);
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
test_function_t func;
|
||||
const char *tags[2];
|
||||
} test_t;
|
||||
|
||||
#define TEST_NO_TAG(name, func) \
|
||||
{ name, func, { NULL, NULL } }
|
||||
#define TEST_ONE_TAG(name, func, tag) \
|
||||
{ name, func, { tag, NULL } }
|
||||
#define TEST_TWO_TAGS(name, func, tag1, tag2) \
|
||||
{ name, func, { tag1, tag2 } }
|
||||
|
||||
typedef struct {
|
||||
const char *name; /*suite name*/
|
||||
pre_post_function_t
|
||||
before_all; /*function invoked before running the suite. If not returning 0, suite is not launched. */
|
||||
pre_post_function_t after_all; /*function invoked at the end of the suite, even if some tests failed. */
|
||||
test_function_t before_each; /*function invoked before each test within this suite. */
|
||||
test_function_t after_each; /*function invoked after each test within this suite, even if it failed. */
|
||||
int nb_tests; /* number of tests */
|
||||
test_t *tests; /* tests within this suite */
|
||||
} test_suite_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define CHECK_ARG(argument, index, argc) \
|
||||
if(index >= argc) { \
|
||||
fprintf(stderr, "Missing argument for \"%s\"\n", argument); \
|
||||
return -1; \
|
||||
} \
|
||||
|
||||
void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list args)
|
||||
, int verbosity_info, int verbosity_error);
|
||||
void bc_tester_helper(const char *name, const char* additionnal_helper);
|
||||
int bc_tester_parse_args(int argc, char** argv, int argid);
|
||||
int bc_tester_start(const char* prog_name);
|
||||
void bc_tester_add_suite(test_suite_t *suite);
|
||||
void bc_tester_uninit(void);
|
||||
void bc_tester_printf(int level, const char *fmt, ...);
|
||||
const char * bc_tester_get_resource_dir_prefix(void);
|
||||
void bc_tester_set_resource_dir_prefix(const char *name);
|
||||
const char * bc_tester_get_writable_dir_prefix(void);
|
||||
void bc_tester_set_writable_dir_prefix(const char *name);
|
||||
|
||||
int bc_tester_nb_suites(void);
|
||||
int bc_tester_nb_tests(const char* name);
|
||||
void bc_tester_list_suites(void);
|
||||
void bc_tester_list_tests(const char *suite_name);
|
||||
const char * bc_tester_suite_name(int suite_index);
|
||||
const char * bc_tester_test_name(const char *suite_name, int test_index);
|
||||
int bc_tester_run_suite(test_suite_t *suite, const char *tag_name);
|
||||
int bc_tester_run_tests(const char *suite_name, const char *test_name, const char *tag_name);
|
||||
int bc_tester_suite_index(const char *suite_name);
|
||||
const char * bc_tester_current_suite_name(void);
|
||||
const char * bc_tester_current_test_name(void);
|
||||
|
||||
char* bc_sprintfva(const char* format, va_list args);
|
||||
char* bc_sprintf(const char* format, ...);
|
||||
void bc_free(void *ptr);
|
||||
|
||||
/**
|
||||
* Get full path to the given resource
|
||||
*
|
||||
* @param name relative resource path
|
||||
* @return path to the resource. Must be freed by caller.
|
||||
*/
|
||||
char * bc_tester_res(const char *name);
|
||||
|
||||
/**
|
||||
* Get full path to the given writable_file
|
||||
*
|
||||
* @param name relative writable file path
|
||||
* @return path to the writable file. Must be freed by caller.
|
||||
*/
|
||||
char * bc_tester_file(const char *name);
|
||||
|
||||
|
||||
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and smarter error message */
|
||||
extern int CU_assertImplementation(int bValue,
|
||||
unsigned int uiLine,
|
||||
const char *strCondition,
|
||||
const char *strFile,
|
||||
const char *strFunction,
|
||||
int bFatal);
|
||||
|
||||
#ifdef _WIN32
|
||||
#define BC_INLINE __inline
|
||||
#else
|
||||
#define BC_INLINE inline
|
||||
#endif
|
||||
|
||||
static BC_INLINE int _BC_ASSERT(const char* file, int line, int predicate, const char* format, int fatal) {
|
||||
if (!predicate) bc_tester_printf(bc_printf_verbosity_info, format, NULL);
|
||||
return CU_assertImplementation(predicate, line, format, file, "", fatal);
|
||||
}
|
||||
|
||||
#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \
|
||||
do { \
|
||||
char format[4096] = {0}; \
|
||||
type cactual = (actual); \
|
||||
type cexpected = (expected); \
|
||||
snprintf(format, 4096, name "(" #actual ", " #expected ") - " __VA_ARGS__); \
|
||||
_BC_ASSERT(__FILE__, __LINE__, pred, format, fatal); \
|
||||
} while (0)
|
||||
|
||||
#define BC_PASS(msg) _BC_ASSERT(__FILE__, __LINE__, TRUE, "BC_PASS(" #msg ").", FALSE)
|
||||
#define BC_FAIL(msg) _BC_ASSERT(__FILE__, __LINE__, FALSE, "BC_FAIL(" #msg ").", FALSE)
|
||||
#define BC_ASSERT(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
|
||||
#define BC_ASSERT_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
|
||||
#define BC_TEST(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
|
||||
#define BC_TEST_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
|
||||
#define BC_ASSERT_TRUE(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE(" #value ")"), FALSE)
|
||||
#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE)
|
||||
#define BC_ASSERT_FALSE(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE)
|
||||
#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE)
|
||||
#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
|
||||
#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
|
||||
#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.", cexpected)
|
||||
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.", cexpected)
|
||||
#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.", cexpected, cactual)
|
||||
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.", cexpected, cactual)
|
||||
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.", cexpected)
|
||||
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.", cexpected)
|
||||
#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NULL but was %p.", cactual)
|
||||
#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NULL but was %p.", cactual)
|
||||
#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NOT NULL but it was.")
|
||||
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NOT NULL but it was.")
|
||||
#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.", cexpected, cactual)
|
||||
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.", cexpected, cactual)
|
||||
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.", cexpected)
|
||||
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.", cexpected)
|
||||
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.", (int)(count), cexpected, (int)(count), cactual)
|
||||
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.", (int)count, cexpected, (int)count, cactual)
|
||||
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.", (int)count, cexpected)
|
||||
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.", (int)count, cexpected)
|
||||
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
|
||||
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
|
||||
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
|
||||
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
|
||||
|
||||
/*Custom defines*/
|
||||
#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected at least " type_format " but was " type_format ".", cexpected, cactual)
|
||||
#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected at most " type_format " but was " type_format ".", cexpected, cactual)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -55,9 +55,9 @@ FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress*
|
|||
else
|
||||
dest = ms_strdup_printf("%s",linphone_address_get_domain(dest_addres));
|
||||
//until errors logs are handled correctly and stop breaks output, they will be DISABLED
|
||||
command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario,dest_username,dest);
|
||||
command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 2>/dev/null",senario,dest_username,dest);
|
||||
|
||||
ms_message("Starting sipp commad [%s]",command);
|
||||
ms_message("Starting sipp command [%s]",command);
|
||||
file = popen(command, "r");
|
||||
ms_free(command);
|
||||
ms_free(dest);
|
||||
|
|
@ -74,9 +74,9 @@ static FILE *sip_start_recv(const char *senario) {
|
|||
FILE *file;
|
||||
|
||||
//until errors logs are handled correctly and stop breaks output, they will be DISABLED
|
||||
command = ms_strdup_printf(SIPP_COMMAND" -sf %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario);
|
||||
command = ms_strdup_printf(SIPP_COMMAND" -sf %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 2>/dev/null",senario);
|
||||
|
||||
ms_message("Starting sipp commad [%s]",command);
|
||||
ms_message("Starting sipp command [%s]",command);
|
||||
file = popen(command, "r");
|
||||
ms_free(command);
|
||||
return file;
|
||||
|
|
|
|||
|
|
@ -359,15 +359,15 @@ static void publish_without_expires(void){
|
|||
}
|
||||
|
||||
test_t event_tests[] = {
|
||||
TEST_NO_TAG("Subscribe declined", subscribe_test_declined),
|
||||
TEST_NO_TAG("Subscribe terminated by subscriber", subscribe_test_terminated_by_subscriber),
|
||||
TEST_NO_TAG("Subscribe with custom headers", subscribe_test_with_custom_header),
|
||||
TEST_NO_TAG("Subscribe refreshed", subscribe_test_refreshed),
|
||||
TEST_NO_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed),
|
||||
TEST_NO_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier),
|
||||
TEST_NO_TAG("Publish", publish_test),
|
||||
TEST_NO_TAG("Publish without expires", publish_without_expires),
|
||||
TEST_NO_TAG("Publish without automatic refresh",publish_no_auto_test)
|
||||
TEST_ONE_TAG("Subscribe declined", subscribe_test_declined, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe terminated by subscriber", subscribe_test_terminated_by_subscriber, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe with custom headers", subscribe_test_with_custom_header, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe refreshed", subscribe_test_refreshed, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Publish", publish_test, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Publish without expires", publish_without_expires, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Publish without automatic refresh",publish_no_auto_test, "LeaksMemory")
|
||||
};
|
||||
|
||||
test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ static void message_forking(void) {
|
|||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
|
||||
|
||||
|
||||
/*wait a bit that 200Ok for MESSAGE are sent to server before shuting down the cores, because otherwise Flexisip will consider the messages
|
||||
* as not delivered and will expedite them in the next test, after receiving the REGISTER from marie's instances*/
|
||||
wait_for_list(lcs, NULL, 0, 2000);
|
||||
|
||||
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
|
|
@ -97,7 +97,7 @@ static void message_forking_with_unreachable_recipients(void) {
|
|||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
|
||||
/*the following lines are to workaround a problem with messages sent by a previous test (Message forking) that arrive together with REGISTER responses,
|
||||
* because the ForkMessageContext is not terminated at flexisip side if Message forking test is passing fast*/
|
||||
wait_for_list(lcs,NULL,0,1000);
|
||||
|
|
@ -153,7 +153,7 @@ static void message_forking_with_all_recipients_unreachable(void) {
|
|||
marie2->stat.number_of_LinphoneMessageReceived = 0;
|
||||
marie3->stat.number_of_LinphoneMessageReceived = 0;
|
||||
|
||||
|
||||
|
||||
/*All marie's device go offline*/
|
||||
linphone_core_set_network_reachable(marie->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
|
|
@ -919,31 +919,31 @@ static void test_subscribe_notify_with_sipp_publisher(void) {
|
|||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
/*just to get an identity*/
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
|
||||
|
||||
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
|
||||
char* lf_identity=linphone_address_as_string_uri_only(marie->identity);
|
||||
LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity);
|
||||
ms_free(lf_identity);
|
||||
|
||||
|
||||
lp_config_set_int(pauline_lp,"sip","subscribe_expires",5);
|
||||
|
||||
|
||||
linphone_core_add_friend(pauline->lc,lf);
|
||||
|
||||
|
||||
/*wait for subscribe acknowledgment*/
|
||||
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
|
||||
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
|
||||
|
||||
|
||||
scen = bc_tester_res("sipp/simple_publish.xml");
|
||||
|
||||
|
||||
sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity);
|
||||
|
||||
|
||||
if (sipp_out) {
|
||||
/*wait for marie status*/
|
||||
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000);
|
||||
BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d");
|
||||
pclose(sipp_out);
|
||||
}
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
#endif
|
||||
|
|
@ -955,23 +955,23 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
|
|||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
/*just to get an identity*/
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
|
||||
|
||||
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
|
||||
char* lf_identity=linphone_address_as_string_uri_only(marie->identity);
|
||||
LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity);
|
||||
ms_free(lf_identity);
|
||||
lp_config_set_int(pauline_lp,"sip","subscribe_expires",5);
|
||||
|
||||
|
||||
linphone_core_add_friend(pauline->lc,lf);
|
||||
|
||||
|
||||
/*wait for subscribe acknowledgment*/
|
||||
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
|
||||
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
|
||||
|
||||
|
||||
scen = bc_tester_res("sipp/double_publish_with_error.xml");
|
||||
|
||||
|
||||
sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity);
|
||||
|
||||
|
||||
if (sipp_out) {
|
||||
/*wait for marie status*/
|
||||
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000);
|
||||
|
|
@ -979,7 +979,7 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
|
|||
pclose(sipp_out);
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyReceived,2,int, "%d");
|
||||
}
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
#endif
|
||||
|
|
@ -988,7 +988,7 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
|
|||
static void test_publish_unpublish(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneProxyConfig* proxy;
|
||||
|
||||
|
||||
proxy = linphone_core_get_default_proxy_config(marie->lc);
|
||||
linphone_proxy_config_edit(proxy);
|
||||
linphone_proxy_config_enable_publish(proxy,TRUE);
|
||||
|
|
@ -1005,7 +1005,7 @@ static void test_list_subscribe (void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc");
|
||||
|
||||
|
||||
char *list = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<resource-lists xmlns=\"urn:ietf:params:xml:ns:resource-lists\"\n"
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
|
||||
|
|
@ -1014,8 +1014,8 @@ static void test_list_subscribe (void) {
|
|||
"\t<entry uri=\"%s\" />\n"
|
||||
"</list>\n"
|
||||
"</resource-lists>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
LinphoneEvent *lev;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
char * pauline_uri=linphone_address_as_string_uri_only(pauline->identity);
|
||||
|
|
@ -1025,29 +1025,29 @@ static void test_list_subscribe (void) {
|
|||
LinphoneAddress *list_name = linphone_address_new("sip:mescops@sip.example.org");
|
||||
LinphoneProxyConfig* proxy_config;
|
||||
int dummy=0;
|
||||
|
||||
|
||||
ms_free(pauline_uri);
|
||||
ms_free(laure_uri);
|
||||
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,laure->lc);
|
||||
|
||||
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"resource-lists+xml");
|
||||
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
|
||||
|
||||
|
||||
lev=linphone_core_create_subscribe(marie->lc,list_name,"presence",60);
|
||||
|
||||
|
||||
linphone_event_add_custom_header(lev,"Supported","eventlist");
|
||||
linphone_event_add_custom_header(lev,"Accept","application/pidf+xml, application/rlmi+xml");
|
||||
linphone_event_add_custom_header(lev,"Content-Disposition", "recipient-list");
|
||||
linphone_event_add_custom_header(lev,"Require", "recipient-list-subscribe");
|
||||
|
||||
|
||||
linphone_event_send_subscribe(lev,content);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000));
|
||||
|
||||
|
||||
/*make sure marie receives first notification before terminating*/
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000));
|
||||
/*dummy wait to avoid derred notify*/
|
||||
|
|
@ -1056,22 +1056,22 @@ static void test_list_subscribe (void) {
|
|||
linphone_proxy_config_edit(proxy_config);
|
||||
linphone_proxy_config_enable_publish(proxy_config,TRUE);
|
||||
linphone_proxy_config_done(proxy_config);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,2,5000));
|
||||
|
||||
|
||||
proxy_config = linphone_core_get_default_proxy_config(laure->lc);
|
||||
linphone_proxy_config_edit(proxy_config);
|
||||
linphone_proxy_config_enable_publish(proxy_config,TRUE);
|
||||
linphone_proxy_config_done(proxy_config);
|
||||
/*make sure notify is not sent "imadiatly but defered*/
|
||||
BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,3,1000));
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,3,5000));
|
||||
|
||||
|
||||
linphone_event_terminate(lev);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
|
||||
|
||||
|
||||
ms_free(subscribe_content);
|
||||
linphone_address_destroy(list_name);
|
||||
linphone_content_unref(content);
|
||||
|
|
@ -1082,7 +1082,7 @@ static void test_list_subscribe (void) {
|
|||
|
||||
|
||||
test_t flexisip_tests[] = {
|
||||
TEST_NO_TAG("Subscribe forking", subscribe_forking),
|
||||
TEST_ONE_TAG("Subscribe forking", subscribe_forking, "LeaksMemory"),
|
||||
TEST_NO_TAG("Message forking", message_forking),
|
||||
TEST_NO_TAG("Message forking with unreachable recipients", message_forking_with_unreachable_recipients),
|
||||
TEST_NO_TAG("Message forking with all recipients unreachable", message_forking_with_all_recipients_unreachable),
|
||||
|
|
@ -1096,15 +1096,15 @@ test_t flexisip_tests[] = {
|
|||
TEST_NO_TAG("Call forking not responded", call_forking_not_responded),
|
||||
TEST_NO_TAG("Early-media call forking", early_media_call_forking),
|
||||
TEST_NO_TAG("Call with sips", call_with_sips),
|
||||
TEST_NO_TAG("Call with sips not achievable", call_with_sips_not_achievable),
|
||||
TEST_ONE_TAG("Call with sips not achievable", call_with_sips_not_achievable, "LeaksMemory"),
|
||||
TEST_NO_TAG("Call with ipv6", call_with_ipv6),
|
||||
TEST_NO_TAG("Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher),
|
||||
TEST_NO_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish),
|
||||
TEST_NO_TAG("Publish/unpublish", test_publish_unpublish),
|
||||
TEST_NO_TAG("List subscribe", test_list_subscribe),
|
||||
TEST_NO_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client),
|
||||
TEST_NO_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client),
|
||||
TEST_NO_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client),
|
||||
TEST_ONE_TAG("List subscribe", test_list_subscribe, "LeaksMemory"),
|
||||
TEST_ONE_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client, "LeaksMemory"),
|
||||
TEST_ONE_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client, "LeaksMemory"),
|
||||
TEST_ONE_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client, "LeaksMemory"),
|
||||
TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
|
|||
}
|
||||
|
||||
if (ftester_printf == NULL) ftester_printf = log_handler;
|
||||
bc_tester_init(ftester_printf, ORTP_MESSAGE, ORTP_ERROR);
|
||||
bc_tester_init(ftester_printf, ORTP_MESSAGE, ORTP_ERROR, "rcfiles");
|
||||
liblinphone_tester_add_suites();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
|
||||
#include "bc_tester_utils.h"
|
||||
#include <bctoolbox/tester.h>
|
||||
#include "linphonecore.h"
|
||||
#include <mediastreamer2/msutils.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
|
@ -357,7 +357,7 @@ int linphone_core_manager_get_mean_audio_up_bw(const LinphoneCoreManager *mgr);
|
|||
void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled);
|
||||
|
||||
void liblinphone_tester_before_each(void);
|
||||
void liblinphone_tester_after_each(void);
|
||||
int liblinphone_tester_after_each(void);
|
||||
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
|
||||
void liblinphone_tester_uninit(void);
|
||||
int liblinphone_tester_set_log_file(const char *filename);
|
||||
|
|
|
|||
|
|
@ -101,14 +101,14 @@ static void collect_cleanup(LinphoneCoreManager *marie) {
|
|||
linphone_core_reset_log_collection();
|
||||
}
|
||||
|
||||
static LinphoneCoreManager* setup(bool_t enable_logs) {
|
||||
static LinphoneCoreManager* setup(LinphoneLogCollectionState log_collection_state) {
|
||||
LinphoneCoreManager *marie;
|
||||
int timeout = 300;
|
||||
|
||||
collect_init();
|
||||
linphone_core_enable_log_collection(enable_logs);
|
||||
linphone_core_enable_log_collection(log_collection_state);
|
||||
|
||||
marie = linphone_core_manager_new2( "marie_rc", 0);
|
||||
marie = linphone_core_manager_new2("marie_rc", 0);
|
||||
// wait a few seconds to generate some traffic
|
||||
while (--timeout){
|
||||
// Generate some logs - error logs because we must ensure that
|
||||
|
|
@ -238,26 +238,26 @@ static time_t check_file(LinphoneCoreManager* mgr) {
|
|||
}
|
||||
|
||||
static void collect_files_disabled(void) {
|
||||
LinphoneCoreManager* marie = setup(FALSE);
|
||||
LinphoneCoreManager* marie = setup(LinphoneLogCollectionDisabled);
|
||||
BC_ASSERT_PTR_NULL(linphone_core_compress_log_collection());
|
||||
collect_cleanup(marie);
|
||||
}
|
||||
|
||||
static void collect_files_filled(void) {
|
||||
LinphoneCoreManager* marie = setup(TRUE);
|
||||
LinphoneCoreManager* marie = setup(LinphoneLogCollectionEnabled);
|
||||
check_file(marie);
|
||||
collect_cleanup(marie);
|
||||
}
|
||||
|
||||
static void collect_files_small_size(void) {
|
||||
LinphoneCoreManager* marie = setup(TRUE);
|
||||
LinphoneCoreManager* marie = setup(LinphoneLogCollectionEnabled);
|
||||
linphone_core_set_log_collection_max_file_size(5000);
|
||||
check_file(marie);
|
||||
collect_cleanup(marie);
|
||||
}
|
||||
|
||||
static void collect_files_changing_size(void) {
|
||||
LinphoneCoreManager* marie = setup(TRUE);
|
||||
LinphoneCoreManager* marie = setup(LinphoneLogCollectionEnabled);
|
||||
int waiting = 100;
|
||||
|
||||
check_file(marie);
|
||||
|
|
@ -291,7 +291,7 @@ static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogC
|
|||
}
|
||||
static void upload_collected_traces(void) {
|
||||
if (transport_supported(LinphoneTransportTls)) {
|
||||
LinphoneCoreManager* marie = setup(TRUE);
|
||||
LinphoneCoreManager* marie = setup(LinphoneLogCollectionEnabled);
|
||||
int waiting = 100;
|
||||
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
|
||||
v_table->log_collection_upload_state_changed = logCollectionUploadStateChangedCb;
|
||||
|
|
@ -301,17 +301,17 @@ static void upload_collected_traces(void) {
|
|||
linphone_core_set_log_collection_upload_server_url(marie->lc,"https://www.linphone.org:444/lft.php");
|
||||
// Generate some logs
|
||||
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
|
||||
linphone_core_compress_log_collection();
|
||||
ms_free(linphone_core_compress_log_collection());
|
||||
linphone_core_upload_log_collection(marie->lc);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1));
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1, 10000));
|
||||
|
||||
/*try 2 times*/
|
||||
waiting=100;
|
||||
linphone_core_reset_log_collection();
|
||||
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
|
||||
linphone_core_compress_log_collection();
|
||||
ms_free(linphone_core_compress_log_collection());
|
||||
linphone_core_upload_log_collection(marie->lc);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2, 10000));
|
||||
collect_cleanup(marie);
|
||||
}
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ test_t log_collection_tests[] = {
|
|||
TEST_NO_TAG("Collect files filled when enabled", collect_files_filled),
|
||||
TEST_NO_TAG("Logs collected into small file", collect_files_small_size),
|
||||
TEST_NO_TAG("Logs collected when decreasing max size", collect_files_changing_size),
|
||||
TEST_NO_TAG("Upload collected traces", upload_collected_traces)
|
||||
TEST_ONE_TAG("Upload collected traces", upload_collected_traces, "MemoryLeaks")
|
||||
};
|
||||
|
||||
test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
|
||||
|
|
|
|||
|
|
@ -1241,7 +1241,7 @@ static void history_count(void) {
|
|||
messages=linphone_chat_room_get_history(chatroom,0);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d");
|
||||
BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d");
|
||||
|
||||
|
||||
/*check the second most recent msg*/
|
||||
BC_ASSERT_PTR_NOT_NULL(messages);
|
||||
if (messages){
|
||||
|
|
@ -1250,7 +1250,7 @@ static void history_count(void) {
|
|||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
|
||||
|
||||
/*test offset+limit: retrieve the 42th latest msg only and check its content*/
|
||||
|
|
@ -1706,7 +1706,7 @@ void file_transfer_with_http_proxy(void) {
|
|||
|
||||
test_t message_tests[] = {
|
||||
TEST_NO_TAG("Text message", text_message),
|
||||
TEST_NO_TAG("Text message within call dialog", text_message_within_call_dialog),
|
||||
TEST_ONE_TAG("Text message within call dialog", text_message_within_call_dialog, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Text message with credentials from auth callback", text_message_with_credential_from_auth_callback),
|
||||
TEST_NO_TAG("Text message with privacy", text_message_with_privacy),
|
||||
TEST_NO_TAG("Text message compatibility mode", text_message_compatibility_mode),
|
||||
|
|
@ -1717,9 +1717,9 @@ test_t message_tests[] = {
|
|||
TEST_NO_TAG("Transfer message with http proxy", file_transfer_with_http_proxy),
|
||||
TEST_NO_TAG("Transfer message with upload io error", transfer_message_with_upload_io_error),
|
||||
TEST_NO_TAG("Transfer message with download io error", transfer_message_with_download_io_error),
|
||||
TEST_NO_TAG("Transfer message upload cancelled", transfer_message_upload_cancelled),
|
||||
TEST_ONE_TAG("Transfer message upload cancelled", transfer_message_upload_cancelled, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Transfer message download cancelled", transfer_message_download_cancelled),
|
||||
TEST_NO_TAG("Transfer message using external body url", file_transfer_using_external_body_url),
|
||||
TEST_ONE_TAG("Transfer message using external body url", file_transfer_using_external_body_url, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Transfer 2 messages simultaneously", file_transfer_2_messages_simultaneously),
|
||||
TEST_NO_TAG("Text message denied", text_message_denied),
|
||||
TEST_NO_TAG("Info message", info_message),
|
||||
|
|
@ -1738,17 +1738,17 @@ test_t message_tests[] = {
|
|||
TEST_NO_TAG("History count", history_count),
|
||||
#endif
|
||||
TEST_NO_TAG("Text status after destroying chat room", text_status_after_destroying_chat_room),
|
||||
TEST_NO_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url),
|
||||
TEST_NO_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found),
|
||||
TEST_NO_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently),
|
||||
TEST_NO_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom),
|
||||
TEST_ONE_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url, "MemoryLeaks"),
|
||||
TEST_ONE_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found, "MemoryLeaks"),
|
||||
TEST_ONE_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently, "MemoryLeaks"),
|
||||
TEST_ONE_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Real Time Text message", real_time_text_message),
|
||||
TEST_NO_TAG("Real Time Text conversation", real_time_text_conversation),
|
||||
TEST_NO_TAG("Real Time Text without audio", real_time_text_without_audio),
|
||||
TEST_NO_TAG("Real Time Text with srtp", real_time_text_srtp),
|
||||
TEST_NO_TAG("Real Time Text with ice", real_time_text_ice),
|
||||
TEST_NO_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf),
|
||||
TEST_NO_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf),
|
||||
TEST_ONE_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf, "MemoryLeaks"),
|
||||
TEST_ONE_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Real Time Text message with accented characters", real_time_text_message_accented_chars),
|
||||
TEST_NO_TAG("Real Time Text offer answer with different payload numbers (sender side)", real_time_text_message_different_text_codecs_payload_numbers_sender_side),
|
||||
TEST_NO_TAG("Real Time Text offer answer with different payload numbers (receiver side)", real_time_text_message_different_text_codecs_payload_numbers_receiver_side),
|
||||
|
|
|
|||
|
|
@ -50,12 +50,14 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
|
|||
lcs=ms_list_append(lcs,laure->lc);
|
||||
|
||||
BC_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params));
|
||||
linphone_call_params_destroy(marie_params);
|
||||
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
|
||||
|
||||
if (enable_caller_privacy)
|
||||
linphone_call_params_set_privacy(laure_params,LinphonePrivacyId);
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(laure->lc,pauline->identity,laure_params));
|
||||
linphone_call_params_destroy(laure_params);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(laure->lc
|
||||
,pauline->lc
|
||||
|
|
@ -99,7 +101,6 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
|
|||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
|
|
@ -113,6 +114,65 @@ static void call_waiting_indication_with_privacy(void) {
|
|||
call_waiting_indication_with_param(TRUE);
|
||||
}
|
||||
|
||||
static void second_call_rejection(bool_t second_without_audio){
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneCall *pauline_call;
|
||||
LinphoneCallParams *params;
|
||||
LinphoneCall *marie_call;
|
||||
|
||||
/*start a call to pauline*/
|
||||
linphone_core_invite_address(marie->lc, pauline->identity);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc
|
||||
,pauline->lc
|
||||
,&marie->stat.number_of_LinphoneCallOutgoingRinging
|
||||
,1));
|
||||
|
||||
/*attempt to send a second call while the first one is not answered.
|
||||
* It must be rejected by the core, since the audio resources are already engaged for the first call*/
|
||||
params = linphone_core_create_call_params(marie->lc, NULL);
|
||||
linphone_call_params_enable_audio(params, !second_without_audio);
|
||||
marie_call = linphone_core_invite_with_params(marie->lc, "sip:laure_non_exstent@test.linphone.org", params);
|
||||
|
||||
linphone_call_params_destroy(params);
|
||||
|
||||
if (second_without_audio){
|
||||
BC_ASSERT_PTR_NOT_NULL(marie_call);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc
|
||||
,pauline->lc
|
||||
,&marie->stat.number_of_LinphoneCallError
|
||||
,1));
|
||||
|
||||
}else{
|
||||
BC_ASSERT_PTR_NULL(marie_call);
|
||||
}
|
||||
|
||||
pauline_call = linphone_core_get_current_call(pauline->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(pauline_call);
|
||||
if (pauline_call){
|
||||
linphone_core_accept_call(pauline->lc, pauline_call);
|
||||
}
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc
|
||||
,pauline->lc
|
||||
,&marie->stat.number_of_LinphoneCallStreamsRunning
|
||||
,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc
|
||||
,pauline->lc
|
||||
,&pauline->stat.number_of_LinphoneCallStreamsRunning
|
||||
,1));
|
||||
end_call(pauline, marie);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void second_call_rejected_if_first_one_in_progress(void){
|
||||
second_call_rejection(FALSE);
|
||||
}
|
||||
|
||||
static void second_call_allowed_if_not_using_audio(void){
|
||||
second_call_rejection(TRUE);
|
||||
}
|
||||
|
||||
static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState state) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
|
|
@ -193,7 +253,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
|
|||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,laure->lc);
|
||||
if(focus) lcs=ms_list_append(lcs,focus->lc);
|
||||
|
||||
|
||||
is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0);
|
||||
if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus);
|
||||
|
||||
|
|
@ -239,7 +299,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
|
|||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+2,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+2,5000));
|
||||
}
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000));
|
||||
|
|
@ -278,12 +338,12 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
|
|||
BC_ASSERT_EQUAL(ms_list_size(participants), 2, int, "%d");
|
||||
ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
|
||||
}
|
||||
|
||||
|
||||
linphone_core_terminate_conference(marie->lc);
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,is_remote_conf?3:1,10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000));
|
||||
|
||||
|
||||
end:
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
|
@ -305,34 +365,9 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) {
|
|||
|
||||
if (linphone_core_media_encryption_supported(marie->lc,mode)) {
|
||||
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(marie->lc,"stun.linphone.org");
|
||||
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(pauline->lc,"stun.linphone.org");
|
||||
linphone_core_set_firewall_policy(laure->lc,LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(laure->lc,"stun.linphone.org");
|
||||
|
||||
/*work around a to avoid stun resolution to be initiate in call_received callback leading a mainloop reentrency*/
|
||||
/*
|
||||
belle_sip_main_loop_iterate() at belle_sip_loop.c:369
|
||||
belle_sip_main_loop_run [inlined]() at belle_sip_loop.c:478
|
||||
belle_sip_main_loop_sleep() at belle_sip_loop.c:490
|
||||
sal_iterate() at sal_impl.c:745
|
||||
linphone_core_get_stun_server_addrinfo() at misc.c:585
|
||||
linphone_core_gather_ice_candidates() at misc.c:610
|
||||
linphone_call_prepare_ice() at linphonecall.c:1 906
|
||||
linphone_call_new_incoming() at linphonecall.c:1 101
|
||||
call_received() at callbacks.c:347
|
||||
...
|
||||
linphone_core_iterate() at linphonecore.c:2 620
|
||||
...
|
||||
|
||||
linphone_core_set_stun_server() initiates an asynchronous resolution, but it needs a few iteration before it is completed.
|
||||
By calling private function linphone_core_get_stun_server_addrinfo() we make sure to wait that the resolution is done before the
|
||||
test calls actually start.
|
||||
*/
|
||||
linphone_core_get_stun_server_addrinfo(marie->lc);
|
||||
linphone_core_get_stun_server_addrinfo(pauline->lc);
|
||||
linphone_core_get_stun_server_addrinfo(laure->lc);
|
||||
/**/
|
||||
|
||||
linphone_core_set_media_encryption(marie->lc,mode);
|
||||
|
|
@ -602,7 +637,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
|
|||
|
||||
is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0);
|
||||
if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(call(marie,pauline));
|
||||
marie_call_pauline=linphone_core_get_current_call(marie->lc);
|
||||
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
|
||||
|
|
@ -618,14 +653,14 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
|
|||
BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure);
|
||||
|
||||
linphone_core_add_to_conference(marie->lc,marie_call_laure);
|
||||
|
||||
|
||||
if(!is_remote_conf) BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000));
|
||||
else {
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+1,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+1,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,initial_laure_stat.number_of_LinphoneCallEnd+1,5000));
|
||||
}
|
||||
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_conference(marie->lc));
|
||||
|
||||
linphone_core_add_to_conference(marie->lc,marie_call_pauline);
|
||||
|
|
@ -664,7 +699,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
|
|||
} else {
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,initial_pauline_stat.number_of_LinphoneCallEnd+2,5000));
|
||||
}
|
||||
|
||||
|
||||
if(!is_remote_conf) {
|
||||
end_call(laure, marie);
|
||||
end_call(pauline, marie);
|
||||
|
|
@ -773,7 +808,7 @@ static void eject_from_4_participants_conference(void) {
|
|||
linphone_core_manager_destroy(laure);
|
||||
linphone_core_manager_destroy(michelle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void simple_remote_conference(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
|
|
@ -787,10 +822,10 @@ void simple_remote_conference(void) {
|
|||
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
|
||||
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
|
||||
MSList *lcs = NULL;
|
||||
|
||||
|
||||
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
|
||||
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
|
||||
|
||||
|
||||
linphone_proxy_config_edit(laure_proxy_config);
|
||||
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
|
||||
linphone_proxy_config_done(laure_proxy_config);
|
||||
|
|
@ -799,7 +834,7 @@ void simple_remote_conference(void) {
|
|||
ms_list_free(lcs);
|
||||
|
||||
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus);
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
|
|
@ -818,10 +853,10 @@ void simple_remote_conference_shut_down_focus(void) {
|
|||
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
|
||||
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
|
||||
MSList *lcs = NULL;
|
||||
|
||||
|
||||
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
|
||||
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
|
||||
|
||||
|
||||
linphone_proxy_config_edit(laure_proxy_config);
|
||||
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
|
||||
linphone_proxy_config_done(laure_proxy_config);
|
||||
|
|
@ -830,7 +865,7 @@ void simple_remote_conference_shut_down_focus(void) {
|
|||
ms_list_free(lcs);
|
||||
|
||||
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus);
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
|
|
@ -849,10 +884,10 @@ void eject_from_3_participants_remote_conference(void) {
|
|||
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
|
||||
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
|
||||
MSList *lcs = NULL;
|
||||
|
||||
|
||||
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
|
||||
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
|
||||
|
||||
|
||||
linphone_proxy_config_edit(laure_proxy_config);
|
||||
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
|
||||
linphone_proxy_config_done(laure_proxy_config);
|
||||
|
|
@ -871,20 +906,22 @@ void eject_from_3_participants_remote_conference(void) {
|
|||
test_t multi_call_tests[] = {
|
||||
TEST_NO_TAG("Call waiting indication", call_waiting_indication),
|
||||
TEST_NO_TAG("Call waiting indication with privacy", call_waiting_indication_with_privacy),
|
||||
TEST_NO_TAG("Incoming call accepted when outgoing call in progress", incoming_call_accepted_when_outgoing_call_in_progress),
|
||||
TEST_NO_TAG("Incoming call accepted when outgoing call in outgoing ringing", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing),
|
||||
TEST_NO_TAG("Incoming call accepted when outgoing call in outgoing ringing early media", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media),
|
||||
TEST_NO_TAG("Simple conference", simple_conference),
|
||||
TEST_ONE_TAG("Simple conference with ICE", simple_conference_with_ice, "ICE"),
|
||||
TEST_ONE_TAG("Simple ZRTP conference with ICE", simple_zrtp_conference_with_ice, "ICE"),
|
||||
TEST_NO_TAG("Second call rejected if first one in progress", second_call_rejected_if_first_one_in_progress),
|
||||
TEST_NO_TAG("Second call allowed if not using audio", second_call_allowed_if_not_using_audio),
|
||||
TEST_ONE_TAG("Incoming call accepted when outgoing call in progress", incoming_call_accepted_when_outgoing_call_in_progress, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Incoming call accepted when outgoing call in outgoing ringing", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Incoming call accepted when outgoing call in outgoing ringing early media", incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Simple conference", simple_conference, "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Simple conference with ICE", simple_conference_with_ice, "ICE", "LeaksMemory"),
|
||||
TEST_TWO_TAGS("Simple ZRTP conference with ICE", simple_zrtp_conference_with_ice, "ICE", "LeaksMemory"),
|
||||
TEST_NO_TAG("Eject from 3 participants conference", eject_from_3_participants_local_conference),
|
||||
TEST_NO_TAG("Eject from 4 participants conference", eject_from_4_participants_conference),
|
||||
TEST_ONE_TAG("Eject from 4 participants conference", eject_from_4_participants_conference, "LeaksMemory"),
|
||||
TEST_NO_TAG("Simple call transfer", simple_call_transfer),
|
||||
TEST_NO_TAG("Unattended call transfer", unattended_call_transfer),
|
||||
TEST_NO_TAG("Unattended call transfer with error", unattended_call_transfer_with_error),
|
||||
TEST_NO_TAG("Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call),
|
||||
TEST_NO_TAG("Simple remote conference", simple_remote_conference),
|
||||
TEST_NO_TAG("Simple remote conference with shut down focus", simple_remote_conference_shut_down_focus),
|
||||
TEST_ONE_TAG("Simple remote conference with shut down focus", simple_remote_conference_shut_down_focus, "LeaksMemory"),
|
||||
TEST_NO_TAG("Eject from 3 participants in remote conference", eject_from_3_participants_remote_conference),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -980,23 +980,23 @@ static void test_presence_list_subscribe_io_error(void) {
|
|||
}
|
||||
|
||||
test_t presence_tests[] = {
|
||||
TEST_NO_TAG("Simple Subscribe", simple_subscribe),
|
||||
TEST_NO_TAG("Simple Publish", simple_publish),
|
||||
TEST_NO_TAG("Simple Publish with expires", publish_with_expires),
|
||||
/*TEST_NO_TAG("Call with presence", call_with_presence),*/
|
||||
TEST_NO_TAG("Unsubscribe while subscribing", unsubscribe_while_subscribing),
|
||||
TEST_NO_TAG("Presence information", presence_information),
|
||||
TEST_NO_TAG("App managed presence failure", subscribe_failure_handle_by_app),
|
||||
TEST_NO_TAG("Presence SUBSCRIBE forked", subscribe_presence_forked),
|
||||
TEST_NO_TAG("Presence SUBSCRIBE expired", subscribe_presence_expired),
|
||||
TEST_NO_TAG("Subscriber no loguer reachable using server",subscriber_no_longuer_reachable),
|
||||
TEST_NO_TAG("Subscribe with late publish", test_subscribe_notify_publish),
|
||||
TEST_NO_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish),
|
||||
TEST_NO_TAG("Presence list", test_presence_list),
|
||||
TEST_NO_TAG("Presence list without compression", test_presence_list_without_compression),
|
||||
TEST_NO_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown),
|
||||
TEST_NO_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire),
|
||||
TEST_NO_TAG("Presence list, io error",test_presence_list_subscribe_io_error)
|
||||
TEST_ONE_TAG("Simple Subscribe", simple_subscribe, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Simple Publish", simple_publish, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Simple Publish with expires", publish_with_expires, "LeaksMemory"),
|
||||
/*TEST_ONE_TAG("Call with presence", call_with_presence, "LeaksMemory"),*/
|
||||
TEST_ONE_TAG("Unsubscribe while subscribing", unsubscribe_while_subscribing, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence information", presence_information, "LeaksMemory"),
|
||||
TEST_ONE_TAG("App managed presence failure", subscribe_failure_handle_by_app, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence SUBSCRIBE forked", subscribe_presence_forked, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence SUBSCRIBE expired", subscribe_presence_expired, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscriber no loguer reachable using server",subscriber_no_longuer_reachable, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Subscribe with late publish", test_subscribe_notify_publish, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence list", test_presence_list, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence list without compression", test_presence_list_without_compression, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire, "LeaksMemory"),
|
||||
TEST_ONE_TAG("Presence list, io error",test_presence_list_subscribe_io_error, "LeaksMemory")
|
||||
};
|
||||
|
||||
test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static void core_init_test(void) {
|
|||
static void linphone_address_test(void) {
|
||||
linphone_address_destroy(create_linphone_address(NULL));
|
||||
BC_ASSERT_PTR_NULL(linphone_address_new("sip:@sip.linphone.org"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void core_sip_transport_test(void) {
|
||||
|
|
@ -84,26 +84,23 @@ static void linphone_interpret_url_test(void)
|
|||
memset ( &v_table,0,sizeof ( v_table ) );
|
||||
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL ( lc );
|
||||
|
||||
|
||||
proxy_config =linphone_core_create_proxy_config(lc);
|
||||
linphone_proxy_config_set_identity(proxy_config, "sip:moi@sip.linphone.org");
|
||||
linphone_proxy_config_enable_register(proxy_config, FALSE);
|
||||
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
|
||||
linphone_core_add_proxy_config(lc, proxy_config);
|
||||
linphone_core_set_default_proxy_config(lc,proxy_config);
|
||||
|
||||
linphone_proxy_config_unref(proxy_config);
|
||||
|
||||
address = linphone_core_interpret_url(lc, sips_address);
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL_FATAL(address);
|
||||
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips");
|
||||
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux");
|
||||
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org");
|
||||
|
||||
linphone_address_destroy(address);
|
||||
|
||||
address = linphone_core_interpret_url(lc,"23");
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(address);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23");
|
||||
|
|
@ -111,7 +108,6 @@ static void linphone_interpret_url_test(void)
|
|||
linphone_address_destroy(address);
|
||||
|
||||
address = linphone_core_interpret_url(lc,"#24");
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(address);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24");
|
||||
|
|
@ -124,12 +120,10 @@ static void linphone_interpret_url_test(void)
|
|||
BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip");
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24");
|
||||
BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org");
|
||||
|
||||
linphone_address_destroy(address);
|
||||
ms_free(tmp);
|
||||
|
||||
|
||||
linphone_core_destroy ( lc );
|
||||
linphone_core_destroy (lc);
|
||||
}
|
||||
|
||||
static void linphone_lpconfig_from_buffer(void){
|
||||
|
|
@ -342,7 +336,7 @@ test_t setup_tests[] = {
|
|||
TEST_NO_TAG("Linphone proxy config server address change (internal api)", linphone_proxy_config_is_server_config_changed_test),
|
||||
TEST_NO_TAG("Linphone core init/uninit", core_init_test),
|
||||
TEST_NO_TAG("Linphone random transport port",core_sip_transport_test),
|
||||
TEST_NO_TAG("Linphone interpret url", linphone_interpret_url_test),
|
||||
TEST_ONE_TAG("Linphone interpret url", linphone_interpret_url_test, "LeaksMemory"),
|
||||
TEST_NO_TAG("LPConfig from buffer", linphone_lpconfig_from_buffer),
|
||||
TEST_NO_TAG("LPConfig zero_len value from buffer", linphone_lpconfig_from_buffer_zerolen_value),
|
||||
TEST_NO_TAG("LPConfig zero_len value from file", linphone_lpconfig_from_file_zerolen_value),
|
||||
|
|
|
|||
|
|
@ -221,6 +221,18 @@ bool_t wait_for_list(MSList* lcs,int* counter,int value,int timeout_ms) {
|
|||
else return TRUE;
|
||||
}
|
||||
|
||||
bool_t wait_for_stun_resolution(LinphoneCoreManager *m) {
|
||||
MSTimeSpec start;
|
||||
int timeout_ms = 10000;
|
||||
|
||||
liblinphone_tester_clock_start(&start);
|
||||
while (m->lc->net_conf.stun_addrinfo == NULL && !liblinphone_tester_clock_elapsed(&start,timeout_ms)) {
|
||||
linphone_core_iterate(m->lc);
|
||||
ms_usleep(20000);
|
||||
}
|
||||
return m->lc->net_conf.stun_addrinfo != NULL;
|
||||
}
|
||||
|
||||
static void set_codec_enable(LinphoneCore* lc,const char* type,int rate,bool_t enable) {
|
||||
MSList* codecs=ms_list_copy(linphone_core_get_audio_codecs(lc));
|
||||
MSList* codecs_it;
|
||||
|
|
@ -332,10 +344,13 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
|
|||
int proxy_count;
|
||||
|
||||
/*BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
|
||||
if (check_for_proxies) /**/
|
||||
if (check_for_proxies){ /**/
|
||||
proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc));
|
||||
else
|
||||
}else{
|
||||
proxy_count=0;
|
||||
/*this is to prevent registration to go on*/
|
||||
linphone_core_set_network_reachable(mgr->lc, FALSE);
|
||||
}
|
||||
|
||||
if (proxy_count){
|
||||
#define REGISTER_TIMEOUT 20 /* seconds */
|
||||
|
|
@ -353,6 +368,15 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
|
|||
mgr->identity = linphone_address_clone(linphone_proxy_config_get_identity_address(proxy));
|
||||
linphone_address_clean(mgr->identity);
|
||||
}
|
||||
|
||||
if (linphone_core_get_stun_server(mgr->lc) != NULL){
|
||||
/*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/
|
||||
BC_ASSERT_TRUE(wait_for_stun_resolution(mgr));
|
||||
}
|
||||
if (!check_for_proxies){
|
||||
/*now that stun server resolution is done, we can start registering*/
|
||||
linphone_core_set_network_reachable(mgr->lc, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneCoreManager* linphone_core_manager_new( const char* rc_file) {
|
||||
|
|
@ -401,7 +425,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
|
|||
if (mgr->identity) {
|
||||
linphone_address_destroy(mgr->identity);
|
||||
}
|
||||
|
||||
|
||||
manager_count--;
|
||||
}
|
||||
|
||||
|
|
@ -518,7 +542,7 @@ void liblinphone_tester_before_each(void) {
|
|||
|
||||
static char* all_leaks_buffer = NULL;
|
||||
|
||||
void liblinphone_tester_after_each(void) {
|
||||
int liblinphone_tester_after_each(void) {
|
||||
if (!liblinphone_tester_leak_detector_disabled){
|
||||
int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count;
|
||||
if (leaked_objects > 0) {
|
||||
|
|
@ -531,12 +555,25 @@ void liblinphone_tester_after_each(void) {
|
|||
ms_error("%s", format);
|
||||
|
||||
all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format);
|
||||
|
||||
{
|
||||
//prevent any future leaks
|
||||
const char **tags = bc_tester_current_test_tags();
|
||||
// if the test is NOT marked as leaking memory and it actually is, we should make it fail
|
||||
if ( tags &&
|
||||
!((tags[0] && strcmp(tags[0], "LeakingMemory")) || (tags[1] && strcmp(tags[1], "LeakingMemory")))) {
|
||||
BC_FAIL("This test is leaking memory!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (manager_count != 0) {
|
||||
ms_fatal("%d Linphone core managers are still alive!", manager_count);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void liblinphone_tester_uninit(void) {
|
||||
|
|
@ -566,8 +603,8 @@ static void check_ice_from_rtp(LinphoneCall *c1, LinphoneCall *c2, LinphoneStrea
|
|||
BC_ASSERT_FALSE(stream_type >= LinphoneStreamTypeUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (linphone_call_get_audio_stats(c1)->ice_state == LinphoneIceStateHostConnection && media_stream_started(ms)) {
|
||||
char ip[16];
|
||||
char port[8];
|
||||
|
|
@ -588,16 +625,16 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
|
|||
bool_t text_success=FALSE;
|
||||
bool_t video_enabled, realtime_text_enabled;
|
||||
MSTimeSpec ts;
|
||||
|
||||
|
||||
c1=linphone_core_get_current_call(caller->lc);
|
||||
c2=linphone_core_get_current_call(callee->lc);
|
||||
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(c1);
|
||||
BC_ASSERT_PTR_NOT_NULL(c2);
|
||||
if (!c1 || !c2) return FALSE;
|
||||
linphone_call_ref(c1);
|
||||
linphone_call_ref(c2);
|
||||
|
||||
|
||||
BC_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)), int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1)),linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c2)), int, "%d");
|
||||
video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1));
|
||||
|
|
@ -617,7 +654,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
|
|||
}
|
||||
ms_usleep(20000);
|
||||
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
|
||||
|
||||
|
||||
if (video_enabled){
|
||||
liblinphone_tester_clock_start(&ts);
|
||||
do{
|
||||
|
|
@ -635,7 +672,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
|
|||
ms_usleep(20000);
|
||||
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
|
||||
}
|
||||
|
||||
|
||||
if (realtime_text_enabled){
|
||||
liblinphone_tester_clock_start(&ts);
|
||||
do{
|
||||
|
|
@ -653,7 +690,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
|
|||
ms_usleep(20000);
|
||||
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
|
||||
}
|
||||
|
||||
|
||||
/*make sure encryption mode are preserved*/
|
||||
if (c1) {
|
||||
const LinphoneCallParams* call_param = linphone_call_get_current_params(c1);
|
||||
|
|
@ -671,12 +708,12 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
|
|||
static void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
|
||||
LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(lc);
|
||||
LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)vtable->user_data;
|
||||
|
||||
|
||||
switch(cstate) {
|
||||
case LinphoneCallIncomingReceived:
|
||||
linphone_core_accept_call(lc, call);
|
||||
break;
|
||||
|
||||
|
||||
case LinphoneCallStreamsRunning:
|
||||
if(linphone_call_get_conference(call) == NULL) {
|
||||
linphone_core_add_to_conference(lc, call);
|
||||
|
|
@ -684,7 +721,7 @@ static void linphone_conference_server_call_state_changed(LinphoneCore *lc, Linp
|
|||
if(conf_srv->first_call == NULL) conf_srv->first_call = linphone_call_ref(call);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LinphoneCallEnd:
|
||||
if(call == conf_srv->first_call) {
|
||||
linphone_core_terminate_conference(lc);
|
||||
|
|
@ -692,7 +729,7 @@ static void linphone_conference_server_call_state_changed(LinphoneCore *lc, Linp
|
|||
conf_srv->first_call = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
@ -702,7 +739,7 @@ static void linphone_conference_server_refer_received(LinphoneCore *core, const
|
|||
LinphoneAddress *refer_to_addr = linphone_address_new(refer_to);
|
||||
char *uri;
|
||||
LinphoneCall *call;
|
||||
|
||||
|
||||
if(refer_to_addr == NULL) return;
|
||||
strncpy(method, linphone_address_get_method_param(refer_to_addr), sizeof(method));
|
||||
if(strcmp(method, "BYE") == 0) {
|
||||
|
|
@ -729,7 +766,7 @@ static void linphone_conference_server_registration_state_changed(LinphoneCore *
|
|||
LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration) {
|
||||
LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)ms_new0(LinphoneConferenceServer, 1);
|
||||
LinphoneCoreManager *lm = (LinphoneCoreManager *)conf_srv;
|
||||
|
||||
|
||||
conf_srv->vtable = linphone_core_v_table_new();
|
||||
conf_srv->vtable->call_state_changed = linphone_conference_server_call_state_changed;
|
||||
conf_srv->vtable->refer_received = linphone_conference_server_refer_received;
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ static void enable_disable_camera_after_camera_switches(void) {
|
|||
test_t video_tests[] = {
|
||||
#if HAVE_GTK
|
||||
TEST_NO_TAG("Early-media video during video call", early_media_video_during_video_call_test),
|
||||
TEST_NO_TAG("Two incoming early-media video calls", two_incoming_early_media_video_calls_test),
|
||||
TEST_ONE_TAG("Two incoming early-media video calls", two_incoming_early_media_video_calls_test, "MemoryLeaks"),
|
||||
TEST_NO_TAG("Early-media video with inactive audio", early_media_video_with_inactive_audio),
|
||||
TEST_NO_TAG("Forked outgoing early-media video call with inactive audio", forked_outgoing_early_media_video_call_with_inactive_audio_test),
|
||||
#endif /*HAVE_GTK*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue