Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
3f86b78b
Commit
3f86b78b
authored
Jul 02, 2015
by
Gautier Pelloux-Prayer
Browse files
tester: update common and display test duration and fix some non removed core managers
parent
d8e8f448
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
184 additions
and
101 deletions
+184
-101
mediastreamer2
mediastreamer2
+1
-1
tester/accountmanager.c
tester/accountmanager.c
+1
-1
tester/call_tester.c
tester/call_tester.c
+20
-19
tester/common/bc_tester_utils.c
tester/common/bc_tester_utils.c
+90
-23
tester/common/bc_tester_utils.h
tester/common/bc_tester_utils.h
+20
-7
tester/flexisip_tester.c
tester/flexisip_tester.c
+2
-2
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+1
-1
tester/log_collection_tester.c
tester/log_collection_tester.c
+2
-2
tester/message_tester.c
tester/message_tester.c
+26
-27
tester/player_tester.c
tester/player_tester.c
+1
-1
tester/register_tester.c
tester/register_tester.c
+8
-7
tester/remote_provisioning_tester.c
tester/remote_provisioning_tester.c
+1
-1
tester/setup_tester.c
tester/setup_tester.c
+2
-2
tester/tester.c
tester/tester.c
+8
-6
tester/video_tester.c
tester/video_tester.c
+1
-1
No files found.
mediastreamer2
@
173e62d6
Subproject commit
20c50eea5e84531555df193db114b588fca383db
Subproject commit
173e62d6c0ec34e89f0f67b0d731150390328b2d
tester/accountmanager.c
View file @
3f86b78b
...
...
@@ -123,7 +123,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
vtable
.
registration_state_changed
=
account_created_on_server_cb
;
vtable
.
auth_info_requested
=
account_created_auth_requested_cb
;
lc
=
configure_lc_from
(
&
vtable
,
bc_tester_
read
_dir_prefix
,
NULL
,
account
);
lc
=
configure_lc_from
(
&
vtable
,
bc_tester_
get_resource
_dir_prefix
()
,
NULL
,
account
);
tr
.
udp_port
=
LC_SIP_TRANSPORT_RANDOM
;
tr
.
tcp_port
=
LC_SIP_TRANSPORT_RANDOM
;
tr
.
tls_port
=
LC_SIP_TRANSPORT_RANDOM
;
...
...
tester/call_tester.c
View file @
3f86b78b
...
...
@@ -1795,8 +1795,8 @@ void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* marie,
}
if
(
mode
==
LinphoneMediaEncryptionDTLS
)
{
/* for DTLS we must access certificates or at least have a directory to store them */
marie
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates-marie"
,
bc_tester_writable_dir_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates-pauline"
,
bc_tester_writable_dir_prefix
);
marie
->
lc
->
user_certificates_path
=
bc_tester_file
(
"certificates-marie"
);
pauline
->
lc
->
user_certificates_path
=
bc_tester_file
(
"certificates-pauline"
);
belle_sip_mkdir
(
marie
->
lc
->
user_certificates_path
);
belle_sip_mkdir
(
pauline
->
lc
->
user_certificates_path
);
}
...
...
@@ -2341,14 +2341,13 @@ static void call_with_file_player(void) {
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
transport_supported
(
LinphoneTransportTls
)
?
"pauline_rc"
:
"pauline_tcp_rc"
);
LinphonePlayer
*
player
;
char
hellopath
[
256
]
;
char
*
recordpath
=
create_filepath
(
bc_tester_writable_dir_prefix
,
"record-call_with_file_player"
,
"wav"
);
char
*
hellopath
=
bc_tester_res
(
"sounds/ahbahouaismaisbon.wav"
)
;
char
*
recordpath
=
create_filepath
(
bc_tester_
get_
writable_dir_prefix
()
,
"record-call_with_file_player"
,
"wav"
);
bool_t
call_ok
;
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink
(
recordpath
);
snprintf
(
hellopath
,
sizeof
(
hellopath
),
"%s/sounds/ahbahouaismaisbon.wav"
,
bc_tester_read_dir_prefix
);
/*caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player*/
linphone_core_use_files
(
marie
->
lc
,
TRUE
);
...
...
@@ -2395,6 +2394,7 @@ end:
linphone_core_manager_destroy
(
marie
);
linphone_core_manager_destroy
(
pauline
);
ms_free
(
recordpath
);
ms_free
(
hellopath
);
}
static
bool_t
is_format_supported
(
LinphoneCore
*
lc
,
const
char
*
fmt
){
...
...
@@ -2409,8 +2409,8 @@ static void call_with_mkv_file_player(void) {
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
transport_supported
(
LinphoneTransportTls
)
?
"pauline_rc"
:
"pauline_tcp_rc"
);
LinphonePlayer
*
player
;
char
hellomkv
[
256
]
;
char
hellowav
[
256
]
;
char
*
hellomkv
;
char
*
hellowav
;
char
*
recordpath
;
bool_t
call_ok
;
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
...
...
@@ -2418,17 +2418,17 @@ static void call_with_mkv_file_player(void) {
const
double
threshold
=
0
.
9
;
#define DO_AUDIO_CMP
#endif
hellomkv
=
bc_tester_res
(
"sounds/hello8000_mkv_ref.wav"
);
hellowav
=
bc_tester_res
(
"sounds/hello8000.mkv"
);
if
(
!
is_format_supported
(
marie
->
lc
,
"mkv"
)){
ms_warning
(
"Test skipped, no mkv support."
);
goto
end
;
}
recordpath
=
create_filepath
(
bc_tester_writable_dir_prefix
,
"record-call_with_mkv_file_player"
,
"wav"
);
recordpath
=
create_filepath
(
bc_tester_
get_
writable_dir_prefix
()
,
"record-call_with_mkv_file_player"
,
"wav"
);
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink
(
recordpath
);
snprintf
(
hellowav
,
sizeof
(
hellowav
),
"%s/sounds/hello8000_mkv_ref.wav"
,
bc_tester_read_dir_prefix
);
snprintf
(
hellomkv
,
sizeof
(
hellomkv
),
"%s/sounds/hello8000.mkv"
,
bc_tester_read_dir_prefix
);
/*caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player*/
linphone_core_use_files
(
marie
->
lc
,
TRUE
);
...
...
@@ -2474,7 +2474,8 @@ static void call_with_mkv_file_player(void) {
end:
linphone_core_manager_destroy
(
marie
);
linphone_core_manager_destroy
(
pauline
);
ms_free
(
hellomkv
);
ms_free
(
hellowav
);
}
void
call_base_with_configfile
(
LinphoneMediaEncryption
mode
,
bool_t
enable_video
,
bool_t
enable_relay
,
LinphoneFirewallPolicy
policy
,
bool_t
enable_tunnel
,
const
char
*
marie_rc
,
const
char
*
pauline_rc
)
{
...
...
@@ -2508,8 +2509,8 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video
linphone_core_set_media_encryption
(
marie
->
lc
,
mode
);
linphone_core_set_media_encryption
(
pauline
->
lc
,
mode
);
if
(
mode
==
LinphoneMediaEncryptionDTLS
)
{
/* for DTLS we must access certificates or at least have a directory to store them */
marie
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates-marie"
,
bc_tester_writable_dir_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates-pauline"
,
bc_tester_writable_dir_prefix
);
marie
->
lc
->
user_certificates_path
=
bc_tester_file
(
"certificates-marie"
);
pauline
->
lc
->
user_certificates_path
=
bc_tester_file
(
"certificates-pauline"
);
belle_sip_mkdir
(
marie
->
lc
->
user_certificates_path
);
belle_sip_mkdir
(
pauline
->
lc
->
user_certificates_path
);
}
...
...
@@ -3415,7 +3416,7 @@ static void record_call(const char *filename, bool_t enableVideo) {
formats
=
linphone_core_get_supported_file_formats
(
marie
->
lc
);
for
(
i
=
0
,
format
=
formats
[
0
];
format
!=
NULL
;
i
++
,
format
=
formats
[
i
])
{
filepath
=
create_filepath
(
bc_tester_writable_dir_prefix
,
filename
,
format
);
filepath
=
create_filepath
(
bc_tester_
get_
writable_dir_prefix
()
,
filename
,
format
);
remove
(
filepath
);
linphone_call_params_set_record_file
(
marieParams
,
filepath
);
BC_ASSERT_TRUE
(
call_succeeded
=
call_with_params
(
marie
,
pauline
,
marieParams
,
paulineParams
));
...
...
@@ -3453,7 +3454,7 @@ static void video_call_snapshot(void) {
LinphoneCallParams
*
marieParams
=
linphone_core_create_default_call_parameters
(
marie
->
lc
);
LinphoneCallParams
*
paulineParams
=
linphone_core_create_default_call_parameters
(
pauline
->
lc
);
LinphoneCall
*
callInst
=
NULL
;
char
*
filename
=
create_filepath
(
bc_tester_writable_dir_prefix
,
"snapshot"
,
"jpeg"
);
char
*
filename
=
create_filepath
(
bc_tester_
get_
writable_dir_prefix
()
,
"snapshot"
,
"jpeg"
);
int
dummy
=
0
;
bool_t
call_succeeded
=
FALSE
;
...
...
@@ -3920,8 +3921,8 @@ static void call_with_generic_cn(void) {
LinphoneCoreManager
*
marie
;
LinphoneCoreManager
*
pauline
;
LinphoneCall
*
pauline_call
;
char
*
audio_file_with_silence
=
ms_strdup_printf
(
"%s/%s"
,
bc_tester_read_dir_prefix
,
"sounds/ahbahouaismaisbon.wav"
);
char
*
recorded_file
=
ms_strdup_printf
(
"%s/%s"
,
bc_tester_writable_dir_prefix
,
"result.wav"
);
char
*
audio_file_with_silence
=
bc_tester_res
(
"sounds/ahbahouaismaisbon.wav"
);
char
*
recorded_file
=
bc_tester_file
(
"result.wav"
);
belle_sip_object_enable_leak_detector
(
TRUE
);
begin
=
belle_sip_object_get_object_count
();
...
...
@@ -4165,8 +4166,8 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
LinphoneCoreManager
*
marie
;
LinphoneCoreManager
*
pauline
;
PayloadType
*
pt
;
char
*
stereo_file
=
ms_strdup_printf
(
"%s/%s"
,
bc_tester_read_dir_prefix
,
"sounds/vrroom.wav"
);
char
*
recordpath
=
create_filepath
(
bc_tester_writable_dir_prefix
,
"stereo-record"
,
"wav"
);
char
*
stereo_file
=
bc_tester_res
(
"sounds/vrroom.wav"
);
char
*
recordpath
=
create_filepath
(
bc_tester_
get_
writable_dir_prefix
()
,
"stereo-record"
,
"wav"
);
int
dummy
=
0
;
belle_sip_object_enable_leak_detector
(
TRUE
);
...
...
tester/common/bc_tester_utils.c
View file @
3f86b78b
...
...
@@ -23,24 +23,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "bc_tester_utils.h"
#include <stdlib.h>
#include <time.h>
#include "CUnit/Basic.h"
#include "CUnit/Automated.h"
#if WINAPI_FAMILY_PHONE_APP
const
char
*
bc_tester_read_dir_prefix
=
"Assets"
;
#elif defined(__QNX__)
const
char
*
bc_tester_read_dir_prefix
=
"./app/native/assets/"
;
#else
const
char
*
bc_tester_read_dir_prefix
=
"."
;
#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
/* TODO: have the same "static" for QNX and windows as above? */
#ifdef ANDROID
const
char
*
bc_tester_writable_dir_prefix
=
"/data/data/org.linphone.tester/cache"
;
#else
const
char
*
bc_tester_writable_dir_prefix
=
"."
;
#endif
#endif
static
char
*
bc_tester_resource_dir_prefix
=
NULL
;
static
char
*
bc_tester_writable_dir_prefix
=
NULL
;
int
bc_printf_verbosity_info
;
int
bc_printf_verbosity_error
;
...
...
@@ -97,7 +102,7 @@ int bc_tester_suite_index(const char *suite_name) {
return
-
1
;
}
int
bc_tester_nb_suites
()
{
int
bc_tester_nb_suites
(
void
)
{
return
nb_test_suites
;
}
...
...
@@ -114,7 +119,7 @@ int bc_tester_nb_tests(const char *suite_name) {
return
test_suite
[
i
]
->
nb_tests
;
}
void
bc_tester_list_suites
()
{
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
));
...
...
@@ -146,15 +151,19 @@ static void suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
}
#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
);
}
static
void
suite_complete_message_handler
(
const
CU_pSuite
pSuite
,
const
CU_pFailureRecord
pFailure
)
{
bc_tester_printf
(
bc_printf_verbosity_info
,
"Suite [%s] ended
\n
"
,
pSuite
->
pName
);
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
)
{
bc_tester_printf
(
bc_printf_verbosity_info
,
"Suite [%s] Test [%s] started"
,
pSuite
->
pName
,
pTest
->
pName
);
test_start_time
=
time
(
NULL
);
}
/*derivated from cunit*/
...
...
@@ -178,7 +187,7 @@ static void test_complete_message_handler(const CU_pTest pTest,
}
else
{
strncat
(
result
,
" passed"
,
strlen
(
" passed"
));
}
bc_tester_printf
(
bc_printf_verbosity_info
,
"%s
\n
"
,
result
);
bc_tester_printf
(
bc_printf_verbosity_info
,
"%s
in %lu sec
\n
"
,
result
,
(
unsigned
long
)(
time
(
NULL
)
-
test_start_time
)
);
}
#endif
...
...
@@ -264,7 +273,7 @@ void bc_tester_helper(const char *name, const char* additionnal_helper) {
"
\t\t\t
--curses
\n
"
#endif
"
\t\t\t
--xml
\n
"
"
\t\t\t
--xml-file <xml file
prefix (will be suffixed by '-Results.xml')
>
\n
"
"
\t\t\t
--xml-file <xml file
name
>
\n
"
"And additionally:
\n
"
"%s"
,
name
...
...
@@ -272,6 +281,22 @@ void bc_tester_helper(const char *name, const char* additionnal_helper) {
}
void
bc_tester_init
(
void
(
*
ftester_printf
)(
int
level
,
const
char
*
fmt
,
va_list
args
),
int
iverbosity_info
,
int
iverbosity_error
)
{
#if defined(BC_TESTER_WINDOWS_PHONE) || defined(BC_TESTER_WINDOWS_UNIVERSAL)
bc_tester_set_resource_dir_prefix
(
"Assets"
);
#elif defined(__QNX__)
bc_tester_set_resource_dir_prefix
(
"./app/native/assets/"
);
#else
bc_tester_set_resource_dir_prefix
(
"."
);
#endif
#ifdef ANDROID
bc_tester_set_writable_dir_prefix
(
"/data/data/org.linphone.tester/cache"
);
#elif defined(__QNX__)
bc_tester_set_writable_dir_prefix
(
"./tmp"
);
#else
bc_tester_set_writable_dir_prefix
(
"."
);
#endif
tester_printf_va
=
ftester_printf
;
bc_printf_verbosity_error
=
iverbosity_error
;
bc_printf_verbosity_info
=
iverbosity_info
;
...
...
@@ -316,7 +341,7 @@ int bc_tester_parse_args(int argc, char **argv, int argid)
return
i
-
argid
+
1
;
}
int
bc_tester_start
()
{
int
bc_tester_start
(
void
)
{
int
ret
;
if
(
xml_enabled
){
size_t
size
=
strlen
(
xml_file
)
+
strlen
(
".tmp"
)
+
1
;
...
...
@@ -341,7 +366,7 @@ void bc_tester_add_suite(test_suite_t *suite) {
}
}
void
bc_tester_uninit
()
{
void
bc_tester_uninit
(
void
)
{
/* Redisplay list of failed tests on end */
if
(
CU_get_number_of_failure_records
()){
CU_basic_show_failures
(
CU_get_failure_list
());
...
...
@@ -364,14 +389,56 @@ void bc_tester_uninit() {
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
;
}
}
char
*
bc_tester_res
(
const
char
*
name
)
{
static
void
bc_tester_set_dir_prefix
(
char
**
prefix
,
const
char
*
name
)
{
size_t
len
=
strlen
(
name
);
if
(
*
prefix
!=
NULL
)
free
(
*
prefix
);
*
prefix
=
malloc
(
len
+
1
);
strncpy
(
*
prefix
,
name
,
len
);
(
*
prefix
)[
len
]
=
'\0'
;
}
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
)
{
char
*
file
=
NULL
;
if
(
name
)
{
size_t
len
=
strlen
(
bc_tester_read_dir_
prefix
)
+
1
+
strlen
(
name
)
+
1
;
size_t
len
=
strlen
(
prefix
)
+
1
+
strlen
(
name
)
+
1
;
file
=
malloc
(
len
);
snprintf
(
file
,
len
,
"%s/%s"
,
bc_tester_read_dir_prefix
,
name
);
snprintf
(
file
,
len
,
"%s/%s"
,
prefix
,
name
);
file
[
strlen
(
file
)]
=
'\0'
;
}
return
file
;
}
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
);
}
tester/common/bc_tester_utils.h
View file @
3f86b78b
...
...
@@ -25,8 +25,9 @@
#include <string.h>
#include <math.h>
extern
const
char
*
bc_tester_read_dir_prefix
;
extern
const
char
*
bc_tester_writable_dir_prefix
;
#ifdef _WIN32
#define snprintf _snprintf
#endif
extern
int
bc_printf_verbosity_info
;
extern
int
bc_printf_verbosity_error
;
...
...
@@ -64,14 +65,18 @@ void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list a
,
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
();
int
bc_tester_start
(
void
);
void
bc_tester_add_suite
(
test_suite_t
*
suite
);
void
bc_tester_uninit
();
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
();
int
bc_tester_nb_suites
(
void
);
int
bc_tester_nb_tests
(
const
char
*
name
);
void
bc_tester_list_suites
();
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
);
...
...
@@ -83,11 +88,19 @@ int bc_tester_suite_index(const char *suite_name);
/**
* Get full path to the given resource
*
* @param name relative resource path
(relative to bc_tester_writable_dir_prefix)
* @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 with smarter error message */
extern
int
CU_assertImplementation
(
int
bValue
,
...
...
tester/flexisip_tester.c
View file @
3f86b78b
...
...
@@ -736,8 +736,8 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
LinphoneContent
*
content
;
FILE
*
file_to_send
=
NULL
;
size_t
file_size
;
char
*
send_filepath
=
ms_strdup_printf
(
"%s/
images/nowebcamCIF.jpg"
,
bc_tester_read_dir_prefix
);
char
*
receive_filepath
=
ms_strdup_printf
(
"%s/receive_file.dump"
,
bc_tester_writable_dir_prefix
);
char
*
send_filepath
=
bc_tester_res
(
"
images/nowebcamCIF.jpg"
);
char
*
receive_filepath
=
bc_tester_file
(
"receive_file.dump"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_init
(
"pauline_rc"
);
linphone_proxy_config_set_custom_header
(
marie
->
lc
->
default_proxy
,
"Accept"
,
"application/sdp"
);
...
...
tester/liblinphone_tester.c
View file @
3f86b78b
...
...
@@ -217,7 +217,7 @@ int main (int argc, char *argv[])
auth_domain
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--config"
)
==
0
){
CHECK_ARG
(
"--config"
,
++
i
,
argc
);
bc_tester_
read
_dir_prefix
=
argv
[
i
];
bc_tester_
set_resource
_dir_prefix
(
argv
[
i
]
)
;
}
else
if
(
strcmp
(
argv
[
i
],
"--dns-hosts"
)
==
0
){
CHECK_ARG
(
"--dns-hosts"
,
++
i
,
argc
);
userhostsfile
=
argv
[
i
];
...
...
tester/log_collection_tester.c
View file @
3f86b78b
...
...
@@ -91,7 +91,7 @@ static size_t getline(char **lineptr, size_t *n, FILE *stream) {
static
LinphoneLogCollectionState
old_collection_state
;
static
void
collect_init
()
{
old_collection_state
=
linphone_core_log_collection_enabled
();
linphone_core_set_log_collection_path
(
bc_tester_writable_dir_prefix
);
linphone_core_set_log_collection_path
(
bc_tester_
get_
writable_dir_prefix
()
);
}
static
void
collect_cleanup
(
LinphoneCoreManager
*
marie
)
{
...
...
@@ -186,7 +186,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
BC_ASSERT_PTR_NOT_NULL
(
file
);
if
(
!
file
)
return
0
;
// 1) expect to find folder name in filename path
BC_ASSERT_PTR_NOT_NULL
(
strstr
(
filepath
,
bc_tester_writable_dir_prefix
));
BC_ASSERT_PTR_NOT_NULL
(
strstr
(
filepath
,
bc_tester_
get_
writable_dir_prefix
()
));
// 2) check file contents
while
(
getline
(
&
line
,
&
line_size
,
file
)
!=
-
1
)
{
...
...
tester/message_tester.c
View file @
3f86b78b
...
...
@@ -64,16 +64,15 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
* */
void
file_transfer_received
(
LinphoneChatMessage
*
message
,
const
LinphoneContent
*
content
,
const
LinphoneBuffer
*
buffer
){
FILE
*
file
=
NULL
;
char
receive_file
[
256
]
;
char
*
receive_file
=
bc_tester_file
(
"receive_file.dump"
)
;
LinphoneChatRoom
*
cr
=
linphone_chat_message_get_chat_room
(
message
);
LinphoneCore
*
lc
=
linphone_chat_room_get_core
(
cr
);
snprintf
(
receive_file
,
sizeof
(
receive_file
),
"%s/receive_file.dump"
,
bc_tester_writable_dir_prefix
);
if
(
!
linphone_chat_message_get_user_data
(
message
))
{
/*first chunk, creating file*/
file
=
fopen
(
receive_file
,
"wb"
);
linphone_chat_message_set_user_data
(
message
,(
void
*
)
file
);
/*store fd for next chunks*/
}
ms_free
(
receive_file
);
file
=
(
FILE
*
)
linphone_chat_message_get_user_data
(
message
);
if
(
linphone_buffer_is_empty
(
buffer
))
{
/* tranfer complete */
...
...
@@ -450,8 +449,8 @@ static void file_transfer_message(void) {
LinphoneContent
*
content
;
FILE
*
file_to_send
=
NULL
;
size_t
file_size
;
char
*
send_filepath
=
ms_strdup_printf
(
"%s/
images/nowebcamCIF.jpg"
,
bc_tester_read_dir_prefix
);
char
*
receive_filepath
=
ms_strdup_printf
(
"%s/receive_file.dump"
,
bc_tester_writable_dir_prefix
);
char
*
send_filepath
=
bc_tester_res
(
"
images/nowebcamCIF.jpg"
);
char
*
receive_filepath
=
bc_tester_file
(
"receive_file.dump"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_tcp_rc"
);
reset_counters
(
&
marie
->
stat
);
...
...
@@ -578,7 +577,7 @@ static void small_file_transfer_message(void) {
#ifdef HAVE_LIME
static
FILE
*
fopen_from_write_dir
(
const
char
*
name
,
const
char
*
mode
)
{
char
*
filepath
=
ms_strdup_printf
(
"%s/
%s"
,
bc_tester_writable_dir_prefix
,
name
);
char
*
filepath
=
bc_tester_res
(
"
%s"
,
bc_tester_writable_dir_prefix
,
name
);
FILE
*
file
=
fopen
(
filepath
,
mode
);
ms_free
(
filepath
);
return
file
;
...
...
@@ -629,11 +628,11 @@ static void lime_file_transfer_message_base(bool_t encrypt_file) {
ms_free
(
marie_id
);
ms_free
(
pauline_id
);
filepath
=
ms_strdup_printf
(
"%s/
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCacheMarie.xml"
);
filepath
=
bc_tester_res
(
"
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCacheMarie.xml"
);
linphone_core_set_zrtp_secrets_file
(
marie
->
lc
,
filepath
);
ms_free
(
filepath
);
filepath
=
ms_strdup_printf
(
"%s/
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCachePauline.xml"
);
filepath
=
bc_tester_res
(
"
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCachePauline.xml"
);
linphone_core_set_zrtp_secrets_file
(
pauline
->
lc
,
filepath
);
ms_free
(
filepath
);
...
...
@@ -890,11 +889,11 @@ static void lime_text_message(void) {
fclose
(
ZIDCacheMarieFD
);
fclose
(
ZIDCachePaulineFD
);
filepath
=
ms_strdup_printf
(
"%s/
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCacheMarie.xml"
);
filepath
=
bc_tester_res
(
"
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCacheMarie.xml"
);
linphone_core_set_zrtp_secrets_file
(
marie
->
lc
,
filepath
);
ms_free
(
filepath
);
filepath
=
ms_strdup_printf
(
"%s/
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCachePauline.xml"
);
filepath
=
bc_tester_res
(
"
%s"
,
bc_tester_writable_dir_prefix
,
"tmpZIDCachePauline.xml"
);
linphone_core_set_zrtp_secrets_file
(
pauline
->
lc
,
filepath
);
ms_free
(
filepath
);
...
...
@@ -1231,8 +1230,8 @@ static void file_transfer_message_two_messages() {
LinphoneContent
*
content
;
FILE
*
file_to_send
=
NULL
;
size_t
file_size
;
char
*
send_filepath
=
ms_strdup_printf
(
"%s/
images/nowebcamCIF.jpg"
,
bc_tester_read_dir_prefix
);
char
*
receive_filepath
=
ms_strdup_printf
(
"%s/receive_file.dump"
,
bc_tester_writable_dir_prefix
);
char
*
send_filepath
=
bc_tester_res
(
"
images/nowebcamCIF.jpg"
);
char
*
receive_filepath
=
bc_tester_file
(
"receive_file.dump"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_tcp_rc"
);
reset_counters
(
&
marie
->
stat
);
...
...
@@ -1444,8 +1443,8 @@ static void info_message_with_args(bool_t with_content) {
if
(
linphone_content_get_buffer
(
content
))
BC_ASSERT_TRUE
(
strcmp
((
const
char
*
)
linphone_content_get_buffer
(
content
),
info_content
)
==
0
);
BC_ASSERT_EQUAL
(
linphone_content_get_size
(
content
),
strlen
(
info_content
),
int
,
"%d"
);
}
linphone_core_manager_destroy
(
marie
);
}
linphone_core_manager_destroy
(
marie
);
linphone_core_manager_destroy
(
pauline
);
}
...
...
@@ -1542,11 +1541,9 @@ static int check_no_strange_time(void* data,int argc, char** argv,char** cNames)
static
void
message_storage_migration
()
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
char
src_db
[
256
]
;
char
tmp_db
[
256
]
;
char
*
src_db
=
bc_tester_res
(
"messages.db"
)
;
char
*
tmp_db
=
bc_tester_file
(
"tmp.db"
)
;
MSList
*
chatrooms
;
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
bc_tester_read_dir_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
bc_tester_writable_dir_prefix
);
BC_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
,
int
,
"%d"
);
...
...
@@ -1565,6 +1562,8 @@ static void message_storage_migration() {
linphone_core_manager_destroy
(
marie
);
remove
(
tmp_db
);
ms_free
(
src_db
);
ms_free
(
tmp_db
);
}
static
void
history_message_count_helper
(
LinphoneChatRoom
*
chatroom
,
int
x
,
int
y
,
int
expected
){
...
...
@@ -1583,10 +1582,8 @@ static void history_range_full_test(){
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneAddress
*
jehan_addr
=
linphone_address_new
(
"<sip:Jehan@sip.linphone.org>"
);
LinphoneChatRoom
*
chatroom
;
char
src_db
[
256
];
char
tmp_db
[
256
];
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
bc_tester_read_dir_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
bc_tester_writable_dir_prefix
);
char
*
src_db
=
bc_tester_res
(
"messages.db"
);
char
*
tmp_db
=
bc_tester_file
(
"tmp.db"
);
BC_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
,
int
,
"%d"
);
...
...
@@ -1613,10 +1610,12 @@ static void history_range_full_test(){
history_message_count_helper
(
chatroom
,
-
1
,
3
,
4
);
history_message_count_helper
(
chatroom
,
-
2
,
2
,
3
);
history_message_count_helper
(
chatroom
,
-
3
,
1
,
2
);
linphone_core_manager_destroy
(
marie
);
}
linphone_core_manager_destroy
(
marie
);
linphone_address_destroy
(
jehan_addr
);
remove
(
tmp_db
);
ms_free
(
src_db
);
ms_free
(
tmp_db
);
}
...
...
@@ -1625,10 +1624,8 @@ static void history_messages_count() {
LinphoneAddress
*
jehan_addr
=
linphone_address_new
(
"<sip:Jehan@sip.linphone.org>"
);
LinphoneChatRoom
*
chatroom
;
MSList
*
messages
;
char
src_db
[
256
];
char
tmp_db
[
256
];
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
bc_tester_read_dir_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
bc_tester_writable_dir_prefix
);
char
*
src_db
=
bc_tester_res
(
"messages.db"
);
char
*
tmp_db
=
bc_tester_file
(
"tmp.db"
);
BC_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
,
int
,
"%d"
);
...
...
@@ -1672,10 +1669,12 @@ static void history_messages_count() {
messages
=
linphone_chat_room_get_history_range
(
chatroom
,
1265
,
1260
);
BC_ASSERT_EQUAL
(
ms_list_size
(
messages
),
1270
-
1265
,
int
,
"%d"
);
ms_list_free_with_data
(
messages
,
(
void
(
*
)(
void
*
))
linphone_chat_message_unref
);
linphone_core_manager_destroy
(
marie
);
}
linphone_core_manager_destroy
(
marie
);
linphone_address_destroy
(
jehan_addr
);
remove
(
tmp_db
);
ms_free
(
src_db
);
ms_free
(
tmp_db
);
}
...
...
tester/player_tester.c
View file @
3f86b78b
...
...
@@ -71,7 +71,7 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
}
static
void
playing_test
(
void
)
{
char
*
filename
=
ms_strdup_printf
(
"%s/
sounds/hello_opus_h264.mkv"
,
bc_tester_read_dir_prefix
);
char
*
filename
=
bc_tester_res
(
"
sounds/hello_opus_h264.mkv"
);