Commit 5cd1775e authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Merge branch 'master' into dev_vcard

Conflicts:
	tester/Makefile.am
parents 425cb42f 1811b9d0
......@@ -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")
......
############################################################################
# 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");
......
mediastreamer2 @ b0fa1989
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),
......
# 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."