Commit 3a5b8b3d authored by Martti Mela's avatar Martti Mela

test_nua*.[ch]: simplified TEST()s to work with Open C compiler

darcs-hash:20070628113611-1b897-3fb1581f68e371a45af4f796a744392e784c207c.gz
parent fce5cb64
......@@ -72,6 +72,7 @@ int test_nua_init(struct context *ctx,
char const *appl_method = NULL;
url_t const *p_uri, *a_uri, *b_uri; /* Proxy URI */
char const *a_bind, *a_bind2;
int err = -1;
url_t b_proxy[1];
a_bind = a_bind2 = "sip:0.0.0.0:*";
......@@ -235,13 +236,15 @@ int test_nua_init(struct context *ctx,
nua_get_params(ctx->a.nua, TAG_ANY(), TAG_END());
run_a_until(ctx, nua_r_get_params, save_until_final_response);
TEST_1(e = ctx->a.specials->head);
TEST(tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END()), 5); TEST_1(m);
err = tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END());
TEST(err, 5);
TEST_1(m);
TEST_1(ctx->a.contact = sip_contact_dup(ctx->home, m));
TEST_1(ctx->a.to = sip_to_dup(ctx->home, sipaddress));
TEST_1(ctx->a.allow = sip_allow_dup(ctx->home, allow));
......@@ -280,13 +283,14 @@ int test_nua_init(struct context *ctx,
nua_get_params(ctx->b.nua, TAG_ANY(), TAG_END());
run_b_until(ctx, nua_r_get_params, save_until_final_response);
TEST_1(e = ctx->b.specials->head);
TEST(tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END()), 5); TEST_1(m);
err = tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END());
TEST(err, 5); TEST_1(m);
TEST_1(ctx->b.contact = sip_contact_dup(ctx->home, m));
TEST_1(ctx->b.to = sip_to_dup(ctx->home, sipaddress));
......@@ -317,13 +321,15 @@ int test_nua_init(struct context *ctx,
nua_get_params(ctx->c.nua, TAG_ANY(), TAG_END());
run_c_until(ctx, nua_r_get_params, save_until_final_response);
TEST_1(e = ctx->c.specials->head);
TEST(tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END()), 5); TEST_1(m);
err = tl_gets(e->data->e_tags,
NTATAG_CONTACT_REF(m),
SIPTAG_FROM_REF(sipaddress),
SIPTAG_ALLOW_REF(allow),
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END());
TEST(err, 5); TEST_1(m);
TEST_1(ctx->c.contact = sip_contact_dup(ctx->home, m));
TEST_1(ctx->c.to = sip_to_dup(ctx->home, sipaddress));
TEST_1(ctx->c.allow = sip_allow_dup(ctx->home, allow));
......
......@@ -117,6 +117,10 @@ int main(int argc, char *argv[])
struct context ctx[1] = {{{ SU_HOME_INIT(ctx) }}};
#if HAVE_OPEN_C
dup2(1, 2);
#endif
if (getenv("EXPENSIVE_CHECKS"))
o_expensive = 1;
......@@ -272,6 +276,25 @@ int main(int argc, char *argv[])
}
#endif
#if HAVE_OPEN_C
tstflags |= tst_verbatim;
level = 9;
o_inat = 1; /* No NATs */
ctx->threading = 1;
ctx->quit_on_single_failure = 1;
su_log_soft_set_level(nua_log, level);
su_log_soft_set_level(soa_log, level);
su_log_soft_set_level(su_log_default, level);
su_log_soft_set_level(nea_log, level);
su_log_soft_set_level(nta_log, level);
su_log_soft_set_level(tport_log, level);
setenv("SU_DEBUG", "9", 1);
setenv("NUA_DEBUG", "9", 1);
setenv("NTA_DEBUG", "9", 1);
setenv("TPORT_DEBUG", "9", 1);
o_events_a = o_events_b = 1;
#endif
su_init();
if (!(TSTFLAGS & tst_verbatim)) {
......@@ -279,6 +302,7 @@ int main(int argc, char *argv[])
level = 1;
su_log_soft_set_level(nua_log, level);
su_log_soft_set_level(soa_log, level);
su_log_soft_set_level(su_log_default, level);
su_log_soft_set_level(nea_log, level);
su_log_soft_set_level(nta_log, level);
su_log_soft_set_level(tport_log, level);
......@@ -288,16 +312,28 @@ int main(int argc, char *argv[])
|| o_events_a || o_events_b || o_events_c)
print_headings = 1;
#if !HAVE_OPEN_C
#define SINGLE_FAILURE_CHECK() \
do { fflush(stdout); \
if (retval && ctx->quit_on_single_failure) { \
su_deinit(); return retval; } \
} while(0)
#else
#define SINGLE_FAILURE_CHECK() \
do { fflush(stdout); \
if (retval && ctx->quit_on_single_failure) { \
su_deinit(); sleep(10); return retval; } \
} while(0)
#endif
ctx->a.printer = o_events_init ? print_event : NULL;
sleep(2);
retval |= test_nua_api_errors(ctx); SINGLE_FAILURE_CHECK();
retval |= test_tag_filter(); SINGLE_FAILURE_CHECK();
retval |= test_nua_params(ctx); SINGLE_FAILURE_CHECK();
retval |= test_nua_init(ctx, o_iproxy, o_proxy, o_inat,
......@@ -351,5 +387,9 @@ int main(int argc, char *argv[])
su_deinit();
#if HAVE_OPEN_C
sleep(7);
#endif
return retval;
}
......@@ -49,6 +49,7 @@ struct call;
#include <sofia-sip/su_log.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/su_tag_io.h>
#include <sofia-sip/nua_tag.h>
#if __APPLE_CC__
#include <sofia-sip/su_osx_runloop.h>
......
......@@ -179,7 +179,8 @@ int test_stack_errors(struct context *ctx)
if (print_headings)
printf("TEST NUA-1.2.2: BYE without INVITE\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END());
TEST_1(a_call->nh);
BYE(a, a_call, a_call->nh, TAG_END());
......@@ -203,7 +204,8 @@ int test_stack_errors(struct context *ctx)
if (print_headings)
printf("TEST NUA-1.2.3: unregister without register\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(a->to), TAG_END()));
a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(a->to), TAG_END());
TEST_1(a_call->nh);
UNREGISTER(a, a_call, a_call->nh, TAG_END());
......@@ -227,7 +229,8 @@ int test_stack_errors(struct context *ctx)
if (print_headings)
printf("TEST NUA-1.2.4: unpublish without publish\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END());
TEST_1(a_call->nh);
UNPUBLISH(a, a_call, a_call->nh, TAG_END());
......
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