[sofia-sip] Build internal tests

This commit is contained in:
Andrey Volk 2020-04-30 18:04:08 +04:00
parent 598d52d5fb
commit 2dced93d94
14 changed files with 25 additions and 17 deletions

View File

@ -1 +1 @@
Thu Apr 16 17:42:40 UTC 2020
Thu Apr 30 14:02:03 UTC 2020

View File

@ -7,7 +7,7 @@
AUTOMAKE_OPTIONS = foreign 1.7
SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) packages # tests s2check utils
SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) packages tests s2check utils
DIST_SUBDIRS = s2check libsofia-sip-ua libsofia-sip-ua-glib utils packages \
tests win32 open_c

View File

@ -1293,7 +1293,7 @@ int test_mime(void)
TEST_1(mp = mp->mp_next);
TEST_1(mp->mp_data);
TEST(memcmp(mp->mp_data, CRLF "--" "LaGqGt4BI6Ho" CR LF, mp->mp_len), 0);
TEST(memcmp(mp->mp_data, CRLF "--" "LaGqGt4BI6Ho" CRLF, mp->mp_len), 0);
TEST_1(c = mp->mp_content_type);
TEST_S(c->c_type, "text/plain"); TEST_S(c->c_subtype, "plain");

View File

@ -61,7 +61,7 @@ LDADD = libnta.la \
../msg/libmsg.la \
../bnf/libbnf.la \
../su/libsu.la \
${top_builddir}/s2check/libs2.a
${top_builddir}/s2check/libs2.a -lz
test_nta_LDFLAGS = -static

View File

@ -52,7 +52,7 @@ check_nua_SOURCES = check_nua.c check_nua.h \
check_etsi.c check_simple.c
check_nua_LDADD = $(nua_libs) ${top_builddir}/s2check/libs2.a \
@CHECK_LIBS@
@CHECK_LIBS@ -lz
nua_libs = libnua.la \
../iptsec/libiptsec.la \

View File

@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = foreign
# Header paths
AM_CPPFLAGS = $(INTERNAL_INCLUDES)
LD_FLAGS = -lz
# ----------------------------------------------------------------------
# Build targets

View File

@ -9,6 +9,7 @@
# Header paths
AM_CPPFLAGS = $(INTERNAL_INCLUDES)
AM_LDFLAGS = -ldl
# ----------------------------------------------------------------------
# Build targets

View File

@ -66,7 +66,7 @@ s2_getlocalinfo(su_localinfo_t const *hints,
su_localinfo_t **return_localinfo)
{
int error = 0, ip4 = 0, ip6 = 0, i;
su_localinfo_t *result = NULL, **rr = &result;
su_localinfo_t *result = NULL, **rr;
su_localinfo_t hh[1] = {{ 0 }};
assert(return_localinfo);

View File

@ -195,13 +195,14 @@ s2_sip_next_request(sip_method_t method, char const *name)
struct message *m;
for (m = s2sip->received; m; m = m->next) {
if (m->sip->sip_request)
if (m->sip->sip_request) {
if (method == sip_method_unknown && name == NULL)
return s2_sip_remove_message(m);
if (m->sip->sip_request->rq_method == method &&
strcmp(m->sip->sip_request->rq_method_name, name) == 0)
return s2_sip_remove_message(m);
if (m->sip->sip_request->rq_method == method &&
strcmp(m->sip->sip_request->rq_method_name, name) == 0)
return s2_sip_remove_message(m);
}
}
return NULL;

View File

@ -57,7 +57,7 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name,
if (strcmp(*patterns, "*")) {
printf("%s: selected\n", name);
}
_tcase_add_test(tc, tf, name, signo, start, end);
_tcase_add_test(tc, tf, name, signo, 0, start, end);
return;
}
}
@ -67,7 +67,7 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name,
if (strcmp(*patterns, "*")) {
printf("%s: selected\n", name);
}
_tcase_add_test(tc, tf, name, signo, start, end);
_tcase_add_test(tc, tf, name, signo, 0, start, end);
return;
}
}

View File

@ -57,7 +57,7 @@ s2_timed_logger(void *stream, char const *fmt, va_list ap)
{
char buffer[4096];
su_time_t now = su_now();
size_t prefix, wrote;
size_t prefix;
int n;
snprintf(buffer, sizeof buffer,
@ -70,5 +70,5 @@ s2_timed_logger(void *stream, char const *fmt, va_list ap)
prefix = strlen(buffer);
n = vsnprintf(buffer + prefix, (sizeof buffer) - prefix, fmt, ap);
if (n > 0)
wrote = fwrite(buffer, prefix + n, 1, stream);
fwrite(buffer, prefix + n, 1, stream);
}

View File

@ -13,7 +13,7 @@ EXTRA_DIST = check_sofia.h check_sofia.c suite_for_nua.c
test_nua_SOURCES = test_nua.c
test_nua_LDADD = $(check_LIBRARIES) \
${sofiabuilddir}/libsofia-sip-ua.la
${sofiabuilddir}/libsofia-sip-ua.la -ldl
check_LIBRARIES = libtestnua.a libtestproxy.a libtestnat.a
@ -47,7 +47,7 @@ check_sofia_LDADD = $(check_LIBRARIES) \
@CHECK_LIBS@
check_dlopen_sofia_CFLAGS = -I$(top_srcdir)/s2check @CHECK_CFLAGS@
check_dlopen_sofia_LDADD = ${top_builddir}/s2check/libs2.a @CHECK_LIBS@
check_dlopen_sofia_LDADD = ${top_builddir}/s2check/libs2.a @CHECK_LIBS@ -ldl
CLEANFILES = tmp_sippasswd.??????

View File

@ -206,7 +206,9 @@ int main(int argc, char *argv[])
int exitcode = 0;
int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1;
int family = 0, multiple = 0;
/*
char const *dnsserver = NULL;
*/
char const *string;
url_t *uri = NULL;
@ -272,8 +274,10 @@ int main(int argc, char *argv[])
if (!family)
dig->ip4 = 1, dig->ip6 = 2;
/*
if (argv[1] && argv[1][0] == '@')
dnsserver = argv++[1] + 1;
*/
if (!argv[1])
usage(2);

View File

@ -398,7 +398,8 @@ char *readfile(FILE *f)
len += fread(buffer + len, 1, 8192, f);
}
buffer[len] = '\0';
if (buffer)
buffer[len] = '\0';
return buffer;
}