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
belle-sip
Commits
6266ceca
Commit
6266ceca
authored
Sep 22, 2015
by
Gautier Pelloux-Prayer
Browse files
tester: fix resource directory detection and compilation
parent
f6f5e00c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
30 deletions
+32
-30
src/belle_sip_object.c
src/belle_sip_object.c
+1
-1
tester/belle_sip_tester.c
tester/belle_sip_tester.c
+13
-14
tester/belle_sip_tester.h
tester/belle_sip_tester.h
+5
-6
tester/common/bc_tester_utils.c
tester/common/bc_tester_utils.c
+13
-9
No files found.
src/belle_sip_object.c
View file @
6266ceca
...
...
@@ -185,7 +185,7 @@ static void _belle_sip_object_uninit(belle_sip_object_t *obj){
}
static
void
_belle_sip_object_clone
(
belle_sip_object_t
*
obj
,
const
belle_sip_object_t
*
orig
){
if
(
orig
->
name
!=
NULL
)
obj
->
name
=
belle_sip_strdup
(
o
bj
->
name
);
if
(
orig
->
name
!=
NULL
)
obj
->
name
=
belle_sip_strdup
(
o
rig
->
name
);
}
static
belle_sip_error_code
_belle_object_marshal
(
belle_sip_object_t
*
obj
,
char
*
buff
,
size_t
buff_size
,
size_t
*
offset
)
{
...
...
tester/belle_sip_tester.c
View file @
6266ceca
...
...
@@ -112,6 +112,19 @@ void belle_sip_tester_uninit(void) {
bc_tester_uninit
();
}
void
belle_sip_tester_before_each
()
{
belle_sip_object_enable_leak_detector
(
TRUE
);
leaked_objects_count
=
belle_sip_object_get_object_count
();
}
void
belle_sip_tester_after_each
()
{
int
leaked_objects
=
belle_sip_object_get_object_count
()
-
leaked_objects_count
;
BC_ASSERT_EQUAL
(
leaked_objects
,
0
,
int
,
"%d"
);
if
(
leaked_objects
>
0
)
{
belle_sip_object_dump_active_objects
();
belle_sip_error
(
"%d objects were leaked in latest test, please fix that!
\n
"
,
leaked_objects
);
}
}
#if !defined(ANDROID) && !defined(TARGET_OS_IPHONE) && !(defined(BELLE_SIP_WINDOWS_PHONE) || defined(BELLE_SIP_WINDOWS_UNIVERSAL))
...
...
@@ -190,18 +203,4 @@ int main (int argc, char *argv[]) {
return
ret
;
}
void
belle_sip_tester_before_each
()
{
belle_sip_object_enable_leak_detector
(
TRUE
);
leaked_objects_count
=
belle_sip_object_get_object_count
();
}
void
belle_sip_tester_after_each
()
{
int
leaked_objects
=
belle_sip_object_get_object_count
()
-
leaked_objects_count
;
BC_ASSERT_EQUAL
(
leaked_objects
,
0
,
int
,
"%d"
);
if
(
leaked_objects
>
0
)
{
belle_sip_object_dump_active_objects
();
belle_sip_error
(
"%d objects were leaked in latest test, please fix that!
\n
"
,
leaked_objects
);
}
}
#endif
tester/belle_sip_tester.h
View file @
6266ceca
...
...
@@ -39,17 +39,16 @@ extern test_suite_t dialog_test_suite;
extern
test_suite_t
refresher_test_suite
;
extern
test_suite_t
http_test_suite
;
extern
int
belle_sip_tester_ipv6_available
(
void
);
extern
const
char
*
belle_sip_tester_get_root_ca_path
(
void
);
extern
void
belle_sip_tester_set_root_ca_path
(
const
char
*
root_ca_path
);
extern
void
belle_sip_tester_init
(
void
(
*
ftester_printf
)(
int
level
,
const
char
*
fmt
,
va_list
args
));
extern
void
belle_sip_tester_uninit
(
void
);
extern
const
char
*
belle_sip_tester_client_cert
;
extern
const
char
*
belle_sip_tester_client_cert_fingerprint
;
extern
const
char
*
belle_sip_tester_private_key
;
extern
const
char
*
belle_sip_tester_private_key_passwd
;
int
belle_sip_tester_ipv6_available
(
void
);
const
char
*
belle_sip_tester_get_root_ca_path
(
void
);
void
belle_sip_tester_set_root_ca_path
(
const
char
*
root_ca_path
);
void
belle_sip_tester_init
(
void
(
*
ftester_printf
)(
int
level
,
const
char
*
fmt
,
va_list
args
));
void
belle_sip_tester_uninit
(
void
);
void
belle_sip_tester_before_each
();
void
belle_sip_tester_after_each
();
...
...
tester/common/bc_tester_utils.c
View file @
6266ceca
...
...
@@ -331,12 +331,12 @@ static int file_exists(const char* root_path) {
int
found
;
FILE
*
file
;
char
*
sound
s_path
=
malloc
(
sizeof
(
char
)
*
(
strlen
(
root_path
)
+
strlen
(
"
sounds
"
)
+
1
));
sprintf
(
sound
s_path
,
"%s
sounds
"
,
root_path
);
file
=
fopen
(
sound
s_path
,
"r"
);
char
*
re
s_path
=
malloc
(
sizeof
(
char
)
*
(
strlen
(
root_path
)
+
strlen
(
"
/common/bc_completion
"
)
+
1
));
sprintf
(
re
s_path
,
"%s
/common/bc_completion
"
,
root_path
);
file
=
fopen
(
re
s_path
,
"r"
);
found
=
(
file
!=
NULL
);
if
(
file
)
fclose
(
file
);
free
(
sound
s_path
);
free
(
re
s_path
);
return
found
;
}
...
...
@@ -356,17 +356,20 @@ static void detect_res_prefix(const char* prog) {
bc_tester_set_writable_dir_prefix
(
"./tmp"
);
#endif
if
(
strchr
(
prog
,
'/'
)
!=
NULL
)
{
progpath
[
strrchr
(
prog
,
'/'
)
-
prog
+
1
]
=
'\0'
;
}
else
if
(
strchr
(
prog
,
'\\'
)
!=
NULL
)
{
progpath
[
strrchr
(
prog
,
'\\'
)
-
prog
+
1
]
=
'\0'
;
if
(
prog
!=
NULL
)
{
progpath
=
strdup
(
prog
);
if
(
strchr
(
prog
,
'/'
)
!=
NULL
)
{
progpath
[
strrchr
(
prog
,
'/'
)
-
prog
+
1
]
=
'\0'
;
}
else
if
(
strchr
(
prog
,
'\\'
)
!=
NULL
)
{
progpath
[
strrchr
(
prog
,
'\\'
)
-
prog
+
1
]
=
'\0'
;
}
}
if
(
file_exists
(
"."
))
{
prefix
=
strdup
(
"."
);
}
else
if
(
file_exists
(
".."
))
{
prefix
=
strdup
(
".."
);
}
else
if
(
file_exists
(
progpath
))
{
}
else
if
(
progpath
&&
file_exists
(
progpath
))
{
prefix
=
strdup
(
progpath
);
}
...
...
@@ -381,6 +384,7 @@ static void detect_res_prefix(const char* prog) {
}
free
(
prefix
);
}
else
if
(
bc_tester_resource_dir_prefix
==
NULL
||
bc_tester_writable_dir_prefix
==
NULL
)
{
printf
(
"Failed to detect resources for %s.
\n
"
,
prog
);
printf
(
"Could not find resource directory in %s! Please try again using option --resource-dir and/or --writable-dir.
\n
"
,
progpath
);
abort
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment