tester: use new macros instead of CUnit ones to get better error logs

parent 5b3c46b0
......@@ -85,3 +85,6 @@ tester/linphone_log.gz.txt
tools/auto_answer
tools/lp-autoanswer
build/macos/pkg-distribution.xml
tester/record_for_lc_*.wav
tester/record-call_with_file_player.wav
......@@ -33,6 +33,7 @@ liblinphonetester_la_SOURCES = \
upnp_tester.c \
video_tester.c \
common/bc_tester_utils.c
liblinphonetester_ladir = $(includedir)/linphone
liblinphonetester_la_HEADERS = common/bc_tester_utils.h
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdlib.h>
#include "CUnit/Basic.h"
#include "CUnit/Automated.h"
#if WINAPI_FAMILY_PHONE_APP
......
This diff is collapsed.
......@@ -43,12 +43,12 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_core_set_use_rfc2833_for_dtmf(pauline->lc, use_rfc2833);
linphone_core_set_use_info_for_dtmf(pauline->lc, use_sipinfo);
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
marie_call = linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL(marie_call);
BC_ASSERT_PTR_NOT_NULL(marie_call);
if (!marie_call) return;
if (dtmf != '\0') {
......@@ -56,7 +56,7 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_call_send_dtmf(marie_call, dtmf);
/*wait for the DTMF to be received from pauline*/
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000));
expected = ms_strdup_printf("%c", dtmf);
}
......@@ -66,29 +66,29 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_call_send_dtmfs(marie_call, dtmf_seq);
/*wait for the DTMF sequence to be received from pauline*/
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq)));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq)));
expected = (dtmf!='\0')?ms_strdup_printf("%c%s",dtmf,dtmf_seq):ms_strdup(dtmf_seq);
}
if (expected != NULL) {
CU_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received);
if (pauline->stat.dtmf_list_received) {
CU_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected);
BC_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected);
}
ms_free(expected);
} else {
CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
}
}
void send_dtmf_cleanup() {
CU_ASSERT_PTR_NULL(marie_call->dtmfs_timer);
CU_ASSERT_PTR_NULL(marie_call->dtmf_sequence);
BC_ASSERT_PTR_NULL(marie_call->dtmfs_timer);
BC_ASSERT_PTR_NULL(marie_call->dtmf_sequence);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
......@@ -116,7 +116,7 @@ static void send_dtmfs_sequence_sip_info() {
static void send_dtmfs_sequence_not_ready() {
marie = linphone_core_manager_new( "marie_rc");
CU_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1);
BC_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1, int, "%d");
linphone_core_manager_destroy(marie);
}
......@@ -127,13 +127,13 @@ static void send_dtmfs_sequence_call_state_changed() {
linphone_call_send_dtmfs(marie_call, "123456789123456789");
/*just after, change call state, and expect DTMF to be canceled*/
linphone_core_pause_call(marie_call->core,marie_call);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1));
/*wait a few time to ensure that no DTMF are received*/
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
send_dtmf_cleanup();
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
......@@ -28,7 +27,6 @@
#include <gtk/gtk.h>
#endif
static FILE * log_file = NULL;
#ifdef ANDROID
......
......@@ -136,7 +136,7 @@ static FILE* gzuncompress(const char* filepath) {
memset(buffer, 0, strlen(buffer));
}
fclose(output);
CU_ASSERT_EQUAL(gzclose(file), Z_OK);
BC_ASSERT_EQUAL(gzclose(file), Z_OK, int, "%d");
ret=fopen(newname, "rb");
ms_free(newname);
return ret;
......@@ -169,7 +169,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
uint32_t timediff = 0;
FILE *file = NULL;
CU_ASSERT_PTR_NOT_NULL(filepath);
BC_ASSERT_PTR_NOT_NULL(filepath);
if (filepath != NULL) {
int line_count = 0;
......@@ -186,10 +186,10 @@ static time_t check_file(LinphoneCoreManager* mgr) {
#else
file = fopen(filepath, "rb");
#endif
CU_ASSERT_PTR_NOT_NULL(file);
BC_ASSERT_PTR_NOT_NULL(file);
if (!file) return 0;
// 1) expect to find folder name in filename path
CU_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix));
BC_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix));
// 2) check file contents
while (getline(&line, &line_size, file) != -1) {
......@@ -205,13 +205,13 @@ static time_t check_file(LinphoneCoreManager* mgr) {
if (strptime(date, "%Y-%m-%d %H:%M:%S", &tm_curr) != NULL) {
tm_curr.tm_isdst = -1; // LOL
log_time = mktime(&tm_curr);
CU_ASSERT_TRUE(log_time >= time_prev);
BC_ASSERT_TRUE(log_time >= time_prev);
time_prev = log_time;
}
}
#endif
}
CU_ASSERT_TRUE(line_count > 25);
BC_ASSERT_TRUE(line_count > 25);
free(line);
fclose(file);
ms_free(filepath);
......@@ -220,7 +220,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
timediff = labs((long int)log_time - (long int)cur_time);
(void)timediff;
#ifndef WIN32
CU_ASSERT_TRUE( timediff <= 1 );
BC_ASSERT_TRUE( timediff <= 1 );
if( !(timediff <= 1) ){
char buffers[2][128] = {{0}};
strftime(buffers[0], sizeof(buffers[0]), "%Y-%m-%d %H:%M:%S", localtime(&log_time));
......@@ -242,7 +242,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
static void collect_files_disabled() {
LinphoneCoreManager* marie = setup(FALSE);
CU_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc));
BC_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc));
collect_cleanup(marie);
}
......@@ -282,7 +282,7 @@ static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogC
break;
case LinphoneCoreLogCollectionUploadStateDelivered:
counters->number_of_LinphoneCoreLogCollectionUploadStateDelivered++;
CU_ASSERT_TRUE(strlen(info)>0)
BC_ASSERT_GREATER(strlen(info), 0, int, "%d");
break;
case LinphoneCoreLogCollectionUploadStateNotDelivered:
counters->number_of_LinphoneCoreLogCollectionUploadStateNotDelivered++;
......@@ -302,7 +302,7 @@ static void upload_collected_traces() {
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
linphone_core_compress_log_collection(marie->lc);
linphone_core_upload_log_collection(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1));
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1));
/*try 2 times*/
waiting=100;
......@@ -310,7 +310,7 @@ static void upload_collected_traces() {
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
linphone_core_compress_log_collection(marie->lc);
linphone_core_upload_log_collection(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
collect_cleanup(marie);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -52,15 +52,15 @@ static void call_multicast_base(bool_t video) {
linphone_core_set_audio_multicast_addr(pauline->lc,"224.1.2.3");
linphone_core_enable_audio_multicast(pauline->lc,TRUE);
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
wait_for_until(marie->lc, pauline->lc, NULL, 1, 3000);
if (linphone_core_get_current_call(marie->lc)) {
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70);
if (video) {
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_cb,marie->lc);
linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc));
CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
}
end_call(marie,pauline);
......@@ -69,7 +69,7 @@ static void call_multicast_base(bool_t video) {
linphone_core_manager_destroy(pauline);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
......@@ -139,8 +139,8 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_invite_address(marie->lc, pauline->identity);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
if (linphone_core_inc_invite_pending(pauline->lc)) {
......@@ -151,8 +151,8 @@ static void early_media_with_multicast_base(bool_t video) {
}
linphone_core_accept_early_media(pauline->lc, linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) );
if (linphone_core_inc_invite_pending(pauline2->lc)) {
/* send a 183 to initiate the early media */
......@@ -162,40 +162,40 @@ static void early_media_with_multicast_base(bool_t video) {
}
linphone_core_accept_early_media(pauline2->lc, linphone_core_get_current_call(pauline2->lc));
CU_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
}
wait_for_list(lcs, &dummy, 1, 3000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90);
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
if (video) {
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
}
if (video) {
CU_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000));
CU_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000));
BC_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000));
BC_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000));
}
linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
if (video) {
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
}
params=linphone_call_params_copy(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)));
......@@ -211,10 +211,10 @@ static void early_media_with_multicast_base(bool_t video) {
, params);
linphone_call_params_destroy(params);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000));
CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
check_media_direction( pauline
, linphone_core_get_current_call(pauline->lc)
......@@ -228,8 +228,8 @@ static void early_media_with_multicast_base(bool_t video) {
, video?LinphoneMediaDirectionSendRecv:LinphoneMediaDirectionInactive);
if (video) {
CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
}
end_call(marie,pauline);
}
......@@ -239,7 +239,7 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_manager_destroy(pauline2);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_EQUAL(leaked_objects,0);
BC_ASSERT_EQUAL(leaked_objects,0, int, "%d");
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
......
......@@ -46,13 +46,13 @@ static void start_with_no_config(void){
int speex16_codec_pos=get_codec_position(codecs, "speex", 16000);
PayloadType *pt;
opus_codec_pos=get_codec_position(codecs, "opus", 48000);
if (opus_codec_pos!=-1) CU_ASSERT_TRUE(opus_codec_pos==0);
CU_ASSERT_TRUE(speex16_codec_pos<speex_codec_pos);
if (opus_codec_pos!=-1) BC_ASSERT_TRUE(opus_codec_pos==0);
BC_ASSERT_TRUE(speex16_codec_pos<speex_codec_pos);
pt=linphone_core_find_payload_type(lc, "speex", 16000, 1);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt) {
CU_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
}
linphone_core_destroy(lc);
}
......@@ -60,15 +60,15 @@ static void start_with_no_config(void){
static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2, int expected_number){
const LinphoneCallParams *params=linphone_call_get_current_params(call1);
const PayloadType *pt=linphone_call_params_get_used_audio_codec(params);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
CU_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
}
params=linphone_call_get_current_params(call2);
pt=linphone_call_params_get_used_audio_codec(params);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
CU_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
}
}
......@@ -84,29 +84,29 @@ static void simple_call_with_different_codec_mappings(void) {
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_rc");
disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1);
/*marie set a fantasy number to PCMU*/
linphone_core_set_payload_type_number(marie->lc,
linphone_core_find_payload_type(marie->lc, "PCMU", 8000, -1),
104);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
pauline_call=linphone_core_get_current_call(pauline->lc);
CU_ASSERT_PTR_NOT_NULL(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if (pauline_call){
LinphoneCallParams *params;
check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104);
/*make a reinvite in the other direction*/
linphone_core_update_call(pauline->lc, pauline_call,
linphone_core_update_call(pauline->lc, pauline_call,
params=linphone_core_create_call_params(pauline->lc, pauline_call));
linphone_call_params_unref(params);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*payload type numbers shall remain the same*/
check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104);
}
......@@ -116,7 +116,7 @@ static void simple_call_with_different_codec_mappings(void) {
linphone_core_manager_destroy(pauline);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
......@@ -137,20 +137,20 @@ static void call_failed_because_of_codecs(void) {
disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1);
out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
/*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/
CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000));
CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0);
BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000));
BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0, int, "%d");
linphone_call_unref(out_call);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
......@@ -194,23 +194,23 @@ static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t
}
CU_ASSERT_TRUE(call(marie, pauline));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(call(marie, pauline));
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));
if (linphone_core_get_current_call(marie->lc)) {
params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc));
CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
}
if (linphone_core_get_current_call(pauline->lc)) {
params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc));
CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
}
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1, int, "%d");
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
......
......@@ -39,11 +39,11 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
bool_t eof = FALSE;
lc_manager = linphone_core_manager_new("marie_rc");
CU_ASSERT_PTR_NOT_NULL(lc_manager);
BC_ASSERT_PTR_NOT_NULL(lc_manager);
if(lc_manager == NULL) return;
player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), video_stream_get_default_video_renderer(), 0);
CU_ASSERT_PTR_NOT_NULL(player);
BC_ASSERT_PTR_NOT_NULL(player);
if(player == NULL) goto fail;
res = linphone_player_open(player, filename, eof_callback, &eof);
......@@ -51,17 +51,17 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
|| (audio_mime == NULL && video_mime == NULL)
|| (video_mime == NULL && audio_mime && !ms_filter_codec_supported(audio_mime))
|| (audio_mime == NULL && video_mime && !ms_filter_codec_supported(video_mime))) {
CU_ASSERT_EQUAL(res, -1);
BC_ASSERT_EQUAL(res, -1, int, "%d");
} else {
CU_ASSERT_EQUAL(res, 0);
BC_ASSERT_EQUAL(res, 0, int, "%d");
}
if(res == -1) goto fail;
res = linphone_player_start(player);
CU_ASSERT_EQUAL(res, 0);
BC_ASSERT_EQUAL(res, 0, int, "%d");
if(res == -1) goto fail;
CU_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000));
BC_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000));
linphone_player_close(player);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
......@@ -38,64 +37,64 @@ void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState st
static void remote_provisioning_skipped(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_http(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_transient(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_transient_remote_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
CU_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE);
CU_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL);
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE);
BC_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL);
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_https(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_not_found(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_404_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_invalid(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_invalid_uri(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_uri_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_default_values(void) {
LinphoneProxyConfig *lpc;
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
lpc = linphone_core_create_proxy_config(marie->lc);
CU_ASSERT_TRUE(lpc->reg_sendregister == TRUE);
CU_ASSERT_TRUE(lpc->expires == 604800);
CU_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
BC_ASSERT_TRUE(lpc->reg_sendregister == TRUE);
BC_ASSERT_TRUE(lpc->expires == 604800);
BC_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
{
LpConfig* lp = linphone_core_get_config(marie->lc);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi");
}
linphone_core_manager_destroy(marie);
......@@ -112,10 +111,10 @@ static void remote_provisioning_file(void) {
#else
marie = linphone_core_manager_new2("marie_remote_localfile_rc", FALSE);
#endif
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
conf = linphone_core_get_config( marie->lc );
CU_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 );
BC_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 , int, "%d");
linphone_core_manager_destroy(marie);
}
......
This diff is collapsed.
......@@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
......@@ -57,10 +56,10 @@ static void linphone_stun_test_encode()
size_t bigLen = STUN_MAX_MESSAGE_SIZE;
size_t len = test_stun_encode(smallBuff, smallLen, TRUE);
CU_ASSERT(len == -1);
BC_ASSERT(len == -1);
len = test_stun_encode(bigBuff, bigLen, TRUE);
CU_ASSERT(len > 0);
BC_ASSERT(len > 0);