Commit 70d3dbb3 authored by Pekka Pessi's avatar Pekka Pessi

test_nua: added test for sf.net bug #1803686

darcs-hash:20071008142435-65a35-78d72330cc6fe982cb9cfe982fc97e42456e4f72.gz
parent 2f9aa799
......@@ -338,6 +338,8 @@ int main(int argc, char *argv[])
retval |= test_nua_params(ctx); SINGLE_FAILURE_CHECK();
retval |= test_nua_destroy(ctx); SINGLE_FAILURE_CHECK();
retval |= test_nua_init(ctx, o_iproxy, o_proxy, o_inat,
TESTNATTAG_SYMMETRIC(o_inat_symmetric),
TESTNATTAG_LOGGING(o_inat_logging),
......
......@@ -327,6 +327,7 @@ int test_nua_init(struct context *ctx,
int test_deinit(struct context *ctx);
int test_nua_api_errors(struct context *ctx);
int test_nua_destroy(struct context *ctx);
int test_stack_errors(struct context *ctx);
int test_tag_filter(void);
int test_nua_params(struct context *ctx);
......
......@@ -34,6 +34,7 @@
#include "config.h"
#include "test_nua.h"
#include "sofia-sip/tport_tag.h"
#if HAVE_FUNC
#elif HAVE_FUNCTION
......@@ -142,6 +143,61 @@ int test_nua_api_errors(struct context *ctx)
/* ======================================================================== */
void destroy_callback(nua_event_t event,
int status, char const *phrase,
nua_t *nua, struct context *ctx,
nua_handle_t *nh, struct call *call,
sip_t const *sip,
tagi_t tags[])
{
if (status >= 200) {
nua_destroy(ctx->a.nua), ctx->a.nua = NULL;
su_root_break(ctx->root);
}
}
/* Test different nua_destroy() corner cases */
int test_nua_destroy(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a;
TEST_1(ctx->root = su_root_create(NULL));
#if 0
a->nua = nua_create(ctx->root, destroy_callback, ctx,
NUTAG_URL("sip:0.0.0.0:*"),
TAG_IF(ctx->a.logging, TPTAG_LOG(1)),
TAG_END());
TEST_1(a->nua);
nua_get_params(a->nua, TAG_ANY(), TAG_END());
su_root_run(ctx->root);
TEST_1(a->nua == NULL);
#endif
a->nua = nua_create(ctx->root, destroy_callback, ctx,
NUTAG_URL("sip:0.0.0.0:*"),
TAG_IF(ctx->a.logging, TPTAG_LOG(1)),
TAG_END());
TEST_1(a->nua);
nua_shutdown(a->nua);
su_root_run(ctx->root);
TEST_1(a->nua == NULL);
su_root_destroy(ctx->root), ctx->root = NULL;
END();
}
/* ======================================================================== */
int test_stack_errors(struct context *ctx)
{
BEGIN();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment