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
d3d0573d
Commit
d3d0573d
authored
Mar 03, 2015
by
Gautier Pelloux-Prayer
Browse files
Tester: create tester_utils which contain factorized code for all testers (in progress)
parent
1ee545b7
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
566 additions
and
204 deletions
+566
-204
tester/Makefile.am
tester/Makefile.am
+16
-15
tester/accountmanager.c
tester/accountmanager.c
+13
-13
tester/call_tester.c
tester/call_tester.c
+13
-13
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+6
-98
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+2
-20
tester/log_collection_tester.c
tester/log_collection_tester.c
+3
-3
tester/message_tester.c
tester/message_tester.c
+13
-13
tester/player_tester.c
tester/player_tester.c
+1
-1
tester/register_tester.c
tester/register_tester.c
+26
-25
tester/setup_tester.c
tester/setup_tester.c
+3
-2
tester/tester_utils.c
tester/tester_utils.c
+392
-0
tester/tester_utils.h
tester/tester_utils.h
+77
-0
tester/video_tester.c
tester/video_tester.c
+1
-1
No files found.
tester/Makefile.am
View file @
d3d0573d
...
...
@@ -11,26 +11,27 @@ liblinphone_HEADERS = liblinphone_tester.h
lib_LTLIBRARIES
=
liblinphonetester.la
liblinphonetester_la_SOURCES
=
tester.c
\
setup_tester.c
\
register_tester.c
\
message_tester.c
\
accountmanager.c
\
call_tester.c
\
multicast_call_tester.c
\
presence_tester.c
\
upnp_tester.c
\
dtmf_tester.c
\
eventapi_tester.c
\
flexisip_tester.c
\
stun_tester.c
\
remote_provisioning_tester.c
\
quality_reporting_tester.c
\
log_collection_tester.c
\
transport_tester.c
\
player_tester.c
\
dtmf_tester.c
\
accountmanager.c
\
message_tester.c
\
multi_call.c
\
multicast_call_tester.c
\
offeranswer_tester.c
\
video_tester.c
\
multi_call.c
player_tester.c
\
presence_tester.c
\
quality_reporting_tester.c
\
register_tester.c
\
remote_provisioning_tester.c
\
setup_tester.c
\
stun_tester.c
\
tester_utils.c
\
transport_tester.c
\
upnp_tester.c
\
video_tester.c
liblinphonetester_la_LDFLAGS
=
-no-undefined
liblinphonetester_la_LIBADD
=
../coreapi/liblinphone.la
$(CUNIT_LIBS)
...
...
tester/accountmanager.c
View file @
d3d0573d
...
...
@@ -33,7 +33,7 @@ typedef struct _Account Account;
Account
*
account_new
(
LinphoneAddress
*
identity
,
const
char
*
unique_id
){
char
*
modified_username
;
Account
*
obj
=
ms_new0
(
Account
,
1
);
/* we need to inhibit leak detector because the two LinphoneAddress will remain behond the scope of the test being run */
belle_sip_object_inhibit_leak_detector
(
TRUE
);
obj
->
identity
=
linphone_address_clone
(
identity
);
...
...
@@ -82,7 +82,7 @@ void account_manager_destroy(void){
Account
*
account_manager_get_account
(
AccountManager
*
m
,
const
LinphoneAddress
*
identity
){
MSList
*
it
;
for
(
it
=
m
->
accounts
;
it
!=
NULL
;
it
=
it
->
next
){
Account
*
a
=
(
Account
*
)
it
->
data
;
if
(
linphone_address_weak_equal
(
a
->
identity
,
identity
)){
...
...
@@ -120,15 +120,15 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
char
*
tmp
;
LinphoneAddress
*
server_addr
;
LCSipTransports
tr
;
vtable
.
registration_state_changed
=
account_created_on_server_cb
;
vtable
.
auth_info_requested
=
account_created_auth_requested_cb
;
lc
=
configure_lc_from
(
&
vtable
,
liblinphone_
tester_file_prefix
,
NULL
,
account
);
lc
=
configure_lc_from
(
&
vtable
,
tester_file_prefix
,
NULL
,
account
);
tr
.
udp_port
=
LC_SIP_TRANSPORT_RANDOM
;
tr
.
tcp_port
=
LC_SIP_TRANSPORT_RANDOM
;
tr
.
tls_port
=
LC_SIP_TRANSPORT_RANDOM
;
linphone_core_set_sip_transports
(
lc
,
&
tr
);
cfg
=
linphone_core_create_proxy_config
(
lc
);
linphone_address_set_secure
(
tmp_identity
,
FALSE
);
linphone_address_set_password
(
tmp_identity
,
account
->
password
);
...
...
@@ -137,7 +137,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
linphone_proxy_config_set_identity
(
cfg
,
tmp
);
ms_free
(
tmp
);
linphone_address_unref
(
tmp_identity
);
server_addr
=
linphone_address_new
(
linphone_proxy_config_get_server_addr
(
refcfg
));
linphone_address_set_secure
(
server_addr
,
FALSE
);
linphone_address_set_transport
(
server_addr
,
LinphoneTransportTcp
);
/*use tcp for account creation, we may not have certificates configured at this stage*/
...
...
@@ -147,9 +147,9 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
ms_free
(
tmp
);
linphone_address_unref
(
server_addr
);
linphone_proxy_config_set_expires
(
cfg
,
3600
);
linphone_core_add_proxy_config
(
lc
,
cfg
);
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
auth_requested
,
1
,
10000
)
==
FALSE
){
ms_fatal
(
"Account for %s could not be created on server."
,
linphone_proxy_config_get_identity
(
refcfg
));
}
...
...
@@ -161,13 +161,13 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
linphone_address_unref
(
tmp_identity
);
ms_free
(
tmp
);
linphone_proxy_config_done
(
cfg
);
ai
=
linphone_auth_info_new
(
linphone_address_get_username
(
account
->
modified_identity
),
NULL
,
account
->
password
,
NULL
,
NULL
,
linphone_address_get_domain
(
account
->
modified_identity
));
linphone_core_add_auth_info
(
lc
,
ai
);
linphone_auth_info_destroy
(
ai
);
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
created
,
1
,
3000
)
==
FALSE
){
ms_fatal
(
"Account for %s is not working on server."
,
linphone_proxy_config_get_identity
(
refcfg
));
}
...
...
@@ -187,7 +187,7 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
LinphoneAuthInfo
*
ai
;
char
*
tmp
;
bool_t
create_account
=
FALSE
;
if
(
!
account
){
account
=
account_new
(
id_addr
,
m
->
unique_id
);
ms_message
(
"No account for %s exists, going to create one."
,
identity
);
...
...
@@ -199,7 +199,7 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
tmp
=
linphone_address_as_string
(
id_addr
);
linphone_proxy_config_set_identity
(
cfg
,
tmp
);
ms_free
(
tmp
);
if
(
create_account
){
account_create_on_server
(
account
,
cfg
);
}
...
...
@@ -208,7 +208,7 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
account
->
password
,
NULL
,
NULL
,
linphone_address_get_domain
(
account
->
modified_identity
));
linphone_core_add_auth_info
(
lc
,
ai
);
linphone_auth_info_destroy
(
ai
);
linphone_address_unref
(
id_addr
);
return
account
->
modified_identity
;
}
...
...
tester/call_tester.c
View file @
d3d0573d
...
...
@@ -1616,8 +1616,8 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
}
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"
,
liblinphone_
tester_file_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/pauline"
,
liblinphone_
tester_file_prefix
);
marie
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/marie"
,
tester_file_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/pauline"
,
tester_file_prefix
);
}
linphone_core_set_media_encryption
(
marie
->
lc
,
mode
);
...
...
@@ -2055,12 +2055,12 @@ static void call_with_file_player(void) {
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_rc"
);
LinphonePlayer
*
player
;
char
hellopath
[
256
];
char
*
recordpath
=
create_filepath
(
liblinphone_
tester_writable_dir_prefix
,
"record"
,
"wav"
);
char
*
recordpath
=
create_filepath
(
tester_writable_dir_prefix
,
"record"
,
"wav"
);
/*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/hello8000.wav"
,
liblinphone_
tester_file_prefix
);
snprintf
(
hellopath
,
sizeof
(
hellopath
),
"%s/sounds/hello8000.wav"
,
tester_file_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
);
...
...
@@ -2133,12 +2133,12 @@ static void call_with_mkv_file_player(void) {
ms_warning
(
"Test skipped, no mkv support."
);
goto
end
;
}
recordpath
=
create_filepath
(
liblinphone_
tester_writable_dir_prefix
,
"record"
,
"wav"
);
recordpath
=
create_filepath
(
tester_writable_dir_prefix
,
"record"
,
"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"
,
liblinphone_
tester_file_prefix
);
snprintf
(
hellomkv
,
sizeof
(
hellomkv
),
"%s/sounds/hello8000.mkv"
,
liblinphone_
tester_file_prefix
);
snprintf
(
hellowav
,
sizeof
(
hellowav
),
"%s/sounds/hello8000_mkv_ref.wav"
,
tester_file_prefix
);
snprintf
(
hellomkv
,
sizeof
(
hellomkv
),
"%s/sounds/hello8000.mkv"
,
tester_file_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
);
...
...
@@ -2216,8 +2216,8 @@ void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_r
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"
,
liblinphone_
tester_file_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/pauline"
,
liblinphone_
tester_file_prefix
);
marie
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/marie"
,
tester_file_prefix
);
pauline
->
lc
->
user_certificates_path
=
ms_strdup_printf
(
"%s/certificates/pauline"
,
tester_file_prefix
);
}
linphone_core_set_firewall_policy
(
marie
->
lc
,
policy
);
...
...
@@ -2849,7 +2849,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
(
liblinphone_
tester_writable_dir_prefix
,
filename
,
format
);
filepath
=
create_filepath
(
tester_writable_dir_prefix
,
filename
,
format
);
remove
(
filepath
);
linphone_call_params_set_record_file
(
marieParams
,
filepath
);
CU_ASSERT_TRUE
(
call_succeeded
=
call_with_params
(
marie
,
pauline
,
marieParams
,
paulineParams
));
...
...
@@ -2887,7 +2887,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
(
liblinphone_
tester_writable_dir_prefix
,
"snapshot"
,
"jpeg"
);
char
*
filename
=
create_filepath
(
tester_writable_dir_prefix
,
"snapshot"
,
"jpeg"
);
int
dummy
=
0
;
bool_t
call_succeeded
=
FALSE
;
...
...
@@ -3331,8 +3331,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"
,
liblinphone_
tester_file_prefix
,
"sounds/ahbahouaismaisbon.wav"
);
char
*
recorded_file
=
ms_strdup_printf
(
"%s/%s"
,
liblinphone_
tester_writable_dir_prefix
,
"result.wav"
);
char
*
audio_file_with_silence
=
ms_strdup_printf
(
"%s/%s"
,
tester_file_prefix
,
"sounds/ahbahouaismaisbon.wav"
);
char
*
recorded_file
=
ms_strdup_printf
(
"%s/%s"
,
tester_writable_dir_prefix
,
"result.wav"
);
belle_sip_object_enable_leak_detector
(
TRUE
);
begin
=
belle_sip_object_get_object_count
();
...
...
tester/liblinphone_tester.c
View file @
d3d0573d
...
...
@@ -28,8 +28,6 @@
#include <gtk/gtk.h>
#endif
extern
int
liblinphone_tester_use_log_file
;
#ifdef ANDROID
#include <android/log.h>
...
...
@@ -132,45 +130,15 @@ static void liblinphone_tester_qnx_log_handler(OrtpLogLevel lev, const char *fmt
void
helper
(
const
char
*
name
)
{
liblinphone_tester_fprintf
(
stderr
,
"%s --help
\n
"
"
\t\t\t
--verbose
\n
"
"
\t\t\t
--silent
\n
"
"
\t\t\t
--list-suites
\n
"
"
\t\t\t
--list-tests <suite>
\n
"
static
const
char
*
liblinphone_helper
=
"
\t\t\t
--config <config path>
\n
"
"
\t\t\t
--domain <test sip domain>
\n
"
"
\t\t\t
--auth-domain <test auth domain>
\n
"
"
\t\t\t
--suite <suite name>
\n
"
"
\t\t\t
--test <test name>
\n
"
"
\t\t\t
--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>
\n
"
"
\t\t\t
--log-file <output log file path>
\n
"
#if HAVE_CU_CURSES
"
\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
"
,
name
);
}
#define CHECK_ARG(argument, index, argc) \
if(index >= argc) { \
fprintf(stderr, "Missing argument for \"%s\"\n", argument); \
return -1; \
} \
"
\t\t\t
--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>
\n
"
;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
int
ret
;
const
char
*
suite_name
=
NULL
;
const
char
*
test_name
=
NULL
;
const
char
*
xml_file
=
"CUnitAutomated-Results.xml"
;
char
*
xml_tmp_file
=
NULL
;
int
xml
=
0
;
FILE
*
log_file
=
NULL
;
#ifdef HAVE_GTK
gtk_init
(
&
argc
,
&
argv
);
#if !GLIB_CHECK_VERSION(2,32,0) // backward compatibility with Debian 6 and CentOS 6
...
...
@@ -190,83 +158,23 @@ int main (int argc, char *argv[])
liblinphone_tester_init
();
for
(
i
=
1
;
i
<
argc
;
++
i
){
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
){
helper
(
argv
[
0
]);
return
0
;
}
else
if
(
strcmp
(
argv
[
i
],
"--verbose"
)
==
0
){
linphone_core_set_log_level
(
ORTP_MESSAGE
|
ORTP_WARNING
|
ORTP_ERROR
|
ORTP_FATAL
);
}
else
if
(
strcmp
(
argv
[
i
],
"--silent"
)
==
0
){
linphone_core_set_log_level
(
ORTP_FATAL
);
}
else
if
(
strcmp
(
argv
[
i
],
"--domain"
)
==
0
){
CHECK_ARG
(
"--domain"
,
++
i
,
argc
);
test_domain
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--auth-domain"
)
==
0
){
CHECK_ARG
(
"--auth-domain"
,
++
i
,
argc
);
auth_domain
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--test"
)
==
0
){
CHECK_ARG
(
"--test"
,
++
i
,
argc
);
test_name
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--config"
)
==
0
){
CHECK_ARG
(
"--config"
,
++
i
,
argc
);
liblinphone_
tester_file_prefix
=
argv
[
i
];
tester_file_prefix
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--dns-hosts"
)
==
0
){
CHECK_ARG
(
"--dns-hosts"
,
++
i
,
argc
);
userhostsfile
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--suite"
)
==
0
){
CHECK_ARG
(
"--suite"
,
++
i
,
argc
);
suite_name
=
argv
[
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"--list-suites"
)
==
0
){
liblinphone_tester_list_suites
();
return
0
;
}
else
if
(
strcmp
(
argv
[
i
],
"--list-tests"
)
==
0
){
CHECK_ARG
(
"--list-tests"
,
++
i
,
argc
);
suite_name
=
argv
[
i
];
liblinphone_tester_list_suite_tests
(
suite_name
);
return
0
;
}
else
if
(
strcmp
(
argv
[
i
],
"--xml-file"
)
==
0
){
CHECK_ARG
(
"--xml-file"
,
++
i
,
argc
);
xml_file
=
argv
[
i
];
xml
=
1
;
}
else
if
(
strcmp
(
argv
[
i
],
"--xml"
)
==
0
){
xml
=
1
;
}
else
if
(
strcmp
(
argv
[
i
],
"--log-file"
)
==
0
){
CHECK_ARG
(
"--log-file"
,
++
i
,
argc
);
log_file
=
fopen
(
argv
[
i
],
"w"
);
if
(
!
log_file
)
{
ms_fatal
(
"Cannot open file [%s] for writting logs because [%s]"
,
argv
[
i
],
strerror
(
errno
));
}
else
{
liblinphone_tester_use_log_file
=
1
;
liblinphone_tester_fprintf
(
stdout
,
"Redirecting traces to file [%s]"
,
argv
[
i
]);
linphone_core_set_log_file
(
log_file
);
}
}
else
{
liblinphone_tester_fprintf
(
stderr
,
"Unknown option
\"
%s
\"\n
"
,
argv
[
i
]);
\
helper
(
argv
[
0
])
;
return
-
1
;
int
ret
=
tester_parse_args
(
argc
,
argv
,
i
,
liblinphone_helper
);
if
(
ret
>
0
)
i
+=
ret
;
else
return
ret
;
}
}
if
(
xml
&&
(
suite_name
||
test_name
)
){
printf
(
"Cannot use both xml and specific test suite
\n
"
);
return
-
1
;
}
if
(
xml
){
xml_tmp_file
=
ms_strdup_printf
(
"%s.tmp"
,
xml_file
);
liblinphone_tester_set_xml_output
(
xml_tmp_file
);
}
liblinphone_tester_enable_xml
(
xml
);
ret
=
liblinphone_tester_run_tests
(
suite_name
,
test_name
);
liblinphone_tester_uninit
();
if
(
xml
)
{
/*create real xml file only if tester did not crash*/
ms_strcat_printf
(
xml_tmp_file
,
"-Results.xml"
);
rename
(
xml_tmp_file
,
xml_file
);
ms_free
(
xml_tmp_file
);
}
return
ret
;
}
#endif
tester/liblinphone_tester.h
View file @
d3d0573d
...
...
@@ -22,34 +22,16 @@
#include "
CUnit/Basic
.h"
#include "
tester_utils
.h"
#include "linphonecore.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
typedef
void
(
*
test_function_t
)(
void
);
typedef
int
(
*
test_suite_function_t
)(
const
char
*
name
);
typedef
struct
{
const
char
*
name
;
test_function_t
func
;
}
test_t
;
typedef
struct
{
const
char
*
name
;
CU_InitializeFunc
init_func
;
CU_CleanupFunc
cleanup_func
;
int
nb_tests
;
test_t
*
tests
;
}
test_suite_t
;
#ifdef __cplusplus
extern
"C"
{
#endif
extern
const
char
*
liblinphone_tester_file_prefix
;
extern
const
char
*
liblinphone_tester_writable_dir_prefix
;
extern
test_suite_t
setup_test_suite
;
extern
test_suite_t
register_test_suite
;
extern
test_suite_t
call_test_suite
;
...
...
@@ -241,7 +223,7 @@ typedef struct _stats {
int
number_of_rtcp_received
;
int
number_of_video_windows_created
;
int
number_of_LinphoneFileTransferDownloadSuccessful
;
int
number_of_LinphoneCoreLogCollectionUploadStateDelivered
;
int
number_of_LinphoneCoreLogCollectionUploadStateNotDelivered
;
...
...
tester/log_collection_tester.c
View file @
d3d0573d
...
...
@@ -67,7 +67,7 @@ static size_t getline(char **lineptr, size_t *n, FILE *stream) {
p
=
bufptr
;
while
(
c
!=
EOF
)
{
size_t
curpos
=
p
-
bufptr
;
if
(
curpos
>
(
size
-
1
))
{
size
=
size
+
128
;
bufptr
=
realloc
(
bufptr
,
size
);
...
...
@@ -94,7 +94,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
(
liblinphone_
tester_writable_dir_prefix
);
linphone_core_set_log_collection_path
(
tester_writable_dir_prefix
);
}
static
void
collect_cleanup
(
LinphoneCoreManager
*
marie
)
{
...
...
@@ -171,7 +171,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
CU_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
,
liblinphone_
tester_writable_dir_prefix
));
CU_ASSERT_PTR_NOT_NULL
(
strstr
(
filepath
,
tester_writable_dir_prefix
));
// 2) check file contents
while
(
getline
(
&
line
,
&
line_size
,
file
)
!=
-
1
)
{
...
...
tester/message_tester.c
View file @
d3d0573d
...
...
@@ -68,7 +68,7 @@ void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent*
char
receive_file
[
256
];
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"
,
liblinphone_
tester_writable_dir_prefix
);
snprintf
(
receive_file
,
sizeof
(
receive_file
),
"%s/receive_file.dump"
,
tester_writable_dir_prefix
);
if
(
!
linphone_chat_message_get_user_data
(
message
))
{
/*first chunk, creating file*/
file
=
fopen
(
receive_file
,
"wb"
);
...
...
@@ -462,8 +462,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"
,
liblinphone_
tester_file_prefix
);
char
*
receive_filepath
=
ms_strdup_printf
(
"%s/receive_file.dump"
,
liblinphone_
tester_writable_dir_prefix
);
char
*
send_filepath
=
ms_strdup_printf
(
"%s/images/nowebcamCIF.jpg"
,
tester_file_prefix
);
char
*
receive_filepath
=
ms_strdup_printf
(
"%s/receive_file.dump"
,
tester_writable_dir_prefix
);
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_rc"
);
...
...
@@ -944,15 +944,15 @@ static void file_transfer_using_external_body_url(void) {
/* create a chatroom on pauline's side */
to
=
linphone_address_as_string
(
marie
->
identity
);
chat_room
=
linphone_core_create_chat_room
(
pauline
->
lc
,
to
);
message
=
linphone_chat_room_create_message
(
chat_room
,
NULL
);
cbs
=
linphone_chat_message_get_callbacks
(
message
);
linphone_chat_message_cbs_set_msg_state_changed
(
cbs
,
liblinphone_tester_chat_message_msg_state_changed
);
linphone_chat_message_set_external_body_url
(
message
,
"https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg"
);
linphone_chat_room_send_chat_message
(
chat_room
,
message
);
CU_ASSERT_TRUE
(
wait_for
(
pauline
->
lc
,
marie
->
lc
,
&
marie
->
stat
.
number_of_LinphoneMessageReceived
,
1
));
if
(
marie
->
stat
.
last_received_chat_message
)
{
linphone_chat_message_download_file
(
marie
->
stat
.
last_received_chat_message
);
...
...
@@ -1391,8 +1391,8 @@ static void message_storage_migration() {
char
src_db
[
256
];
char
tmp_db
[
256
];
MSList
*
chatrooms
;
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
liblinphone_
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
liblinphone_
tester_writable_dir_prefix
);
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
tester_writable_dir_prefix
);
CU_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
);
...
...
@@ -1431,8 +1431,8 @@ static void history_range_full_test(){
LinphoneChatRoom
*
chatroom
;
char
src_db
[
256
];
char
tmp_db
[
256
];
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
liblinphone_
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
liblinphone_
tester_writable_dir_prefix
);
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
tester_writable_dir_prefix
);
CU_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
);
...
...
@@ -1473,8 +1473,8 @@ static void history_messages_count() {
MSList
*
messages
;
char
src_db
[
256
];
char
tmp_db
[
256
];
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
liblinphone_
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
liblinphone_
tester_writable_dir_prefix
);
snprintf
(
src_db
,
sizeof
(
src_db
),
"%s/messages.db"
,
tester_file_prefix
);
snprintf
(
tmp_db
,
sizeof
(
tmp_db
),
"%s/tmp.db"
,
tester_writable_dir_prefix
);
CU_ASSERT_EQUAL_FATAL
(
message_tester_copy_file
(
src_db
,
tmp_db
),
0
);
...
...
tester/player_tester.c
View file @
d3d0573d
...
...
@@ -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"
,
liblinphone_
tester_file_prefix
);
char
*
filename
=
ms_strdup_printf
(
"%s/sounds/hello_opus_h264.mkv"
,
tester_file_prefix
);
const
char
*
audio_mime
=
"opus"
;
const
char
*
video_mime
=
"h264"
;
play_file
(
filename
,
!
linphone_local_player_matroska_supported
(),
audio_mime
,
video_mime
);
...
...
tester/register_tester.c
View file @
d3d0573d
...
...
@@ -18,6 +18,7 @@
#include <stdio.h>
#include "CUnit/Basic.h"
#include "tester_utils.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
...
...
@@ -34,13 +35,13 @@ static void auth_info_requested(LinphoneCore *lc, const char *realm, const char
static
LinphoneCoreManager
*
create_lcm_with_auth
(
unsigned
int
with_auth
)
{
LinphoneCoreManager
*
mgr
=
linphone_core_manager_new
(
NULL
);
if
(
with_auth
)
{
LinphoneCoreVTable
*
vtable
=
linphone_core_v_table_new
();
vtable
->
auth_info_requested
=
auth_info_requested
;
linphone_core_add_listener
(
mgr
->
lc
,
vtable
);
}
/*to allow testing with 127.0.0.1*/
linphone_core_set_network_reachable
(
mgr
->
lc
,
TRUE
);
return
mgr
;
...
...
@@ -195,12 +196,12 @@ static void register_with_custom_headers(void){
LinphoneProxyConfig
*
cfg
=
linphone_core_get_default_proxy_config
(
marie
->
lc
);
int
initial_register_ok
=
marie
->
stat
.
number_of_LinphoneRegistrationOk
;
const
char
*
value
;
linphone_core_set_network_reachable
(
marie
->
lc
,
FALSE
);
linphone_proxy_config_set_custom_header
(
cfg
,
"ah-bah-ouais"
,
"...mais bon."
);
/*unfortunately it is difficult to programmatically check that sent custom headers are actually sent.
* A server development would be required here.*/
linphone_core_set_network_reachable
(
marie
->
lc
,
TRUE
);
wait_for
(
marie
->
lc
,
NULL
,
&
marie
->
stat
.
number_of_LinphoneRegistrationOk
,
initial_register_ok
+
1
);
value
=
linphone_proxy_config_get_custom_header
(
cfg
,
"Server"
);
...
...
@@ -336,11 +337,11 @@ static void authenticated_register_with_no_initial_credentials(){
LinphoneCoreVTable
*
vtable
=
linphone_core_v_table_new
();
stats
*
counters
;
char
route
[
256
];
sprintf
(
route
,
"sip:%s"
,
test_route
);
mgr
=
linphone_core_manager_new
(
NULL
);
vtable
->
auth_info_requested
=
auth_info_requested
;
linphone_core_add_listener
(
mgr
->
lc
,
vtable
);
...
...
@@ -357,9 +358,9 @@ static void authenticated_register_with_late_credentials(){
stats
*
counters
;
LCSipTransports
transport
=
{
5070
,
5070
,
0
,
5071
};
char
route
[
256
];
sprintf
(
route
,
"sip:%s"
,
test_route
);
mgr
=
linphone_core_manager_new
(
NULL
);
counters
=
get_stats
(
mgr
->
lc
);
...
...
@@ -397,9 +398,9 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const
LCSipTransports
transport
=
{
5070
,
5070
,
0
,
5071
};
LinphoneAuthInfo
*
info
=
linphone_auth_info_new
(
test_username
,
NULL
,
"wrong passwd"
,
NULL
,
auth_domain
,
NULL
);
/*create authentication structure from identity*/
char
route
[
256
];
sprintf
(
route
,
"sip:%s"
,
test_route
);
sal_set_refresher_retry_after
(
mgr
->
lc
->
sal
,
500
);
if
(
user_agent
)
{
linphone_core_set_user_agent
(
mgr
->
lc
,
user_agent
,
NULL
);
...
...
@@ -411,7 +412,7 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const
/*wait for retry*/
CU_ASSERT_TRUE
(
wait_for
(
mgr
->
lc
,
mgr
->
lc
,
&
counters
->
number_of_auth_info_requested
,
4
));
CU_ASSERT_EQUAL
(
counters
->
number_of_LinphoneRegistrationFailed
,
1
);
/*check the detailed error info */
if
(
!
user_agent
||
strcmp
(
user_agent
,
"tester-no-403"
)
!=
0
){
LinphoneProxyConfig
*
cfg
=
NULL
;
...
...
@@ -425,7 +426,7 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const
CU_ASSERT_EQUAL
(
linphone_error_info_get_protocol_code
(
ei
),
403
);
CU_ASSERT_PTR_NULL
(
linphone_error_info_get_details
(
ei
));