Commit 5f8a52c7 authored by Pekka Pessi's avatar Pekka Pessi

check_nua: moved s2_fast_forward() to s2 library

Ignore-this: c28d82a4df4eab00ec777495edb46e6a

darcs-hash:20090210131720-db55f-dbb2969da00789bbf64673ec56f5f5e2a7a89910.gz
parent e92e9d0b
......@@ -52,7 +52,10 @@ check_nua_SOURCES = check_nua.c check_nua.h \
check_etsi.c check_simple.c \
test_s2.h test_s2.c
check_nua_LDADD = $(nua_libs) @CHECK_LIBS@
check_nua_LDADD = $(nua_libs) ${top_builddir}/s2check/libs2.a \
@CHECK_LIBS@
check_nua_CFLAGS = $(CFLAGS) -I$(top_srcdir)/s2check
nua_libs = libnua.la \
../iptsec/libiptsec.la \
......
......@@ -244,22 +244,22 @@ START_TEST(SIP_CC_OE_CE_TI_008)
fail_unless(s2_check_callstate(nua_callstate_terminated));
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(21);
s2_fast_forward(21, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(1);
s2_fast_forward(1, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
s2_free_message(invite);
......@@ -294,19 +294,19 @@ START_TEST(SIP_CC_OE_CE_TI_011_012)
fail_unless(s2_check_callstate(nua_callstate_ready));
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(21);
s2_fast_forward(21, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(1);
s2_fast_forward(1, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
s2_free_message(invite);
fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
......
......@@ -335,7 +335,7 @@ START_TEST(register_1_2_2_2)
s2_free_message(m);
su_root_step(s2->root, 20); su_root_step(s2->root, 20);
s2_fast_forward(120); /* Default keepalive interval */
s2_fast_forward(120, s2->root);; /* Default keepalive interval */
mark_point();
m = s2_wait_for_request(SIP_METHOD_OPTIONS);
......@@ -346,7 +346,7 @@ START_TEST(register_1_2_2_2)
s2_free_message(m);
su_root_step(s2->root, 20); su_root_step(s2->root, 20);
s2_fast_forward(120); /* Default keepalive interval */
s2_fast_forward(120, s2->root);; /* Default keepalive interval */
mark_point();
receive_natted = "received=4.255.255.10";
......@@ -400,7 +400,7 @@ START_TEST(register_1_2_2_3)
receive_natted = "received=4.255.255.10";
s2_fast_forward(3600);
s2_fast_forward(3600, s2->root);;
mark_point();
m = s2_wait_for_request(SIP_METHOD_REGISTER);
......@@ -637,7 +637,7 @@ START_TEST(register_1_3_3_1)
if (!tport_is_udp(m->tport)) /* Drop UDP */
break;
s2_free_message(m);
s2_fast_forward(4);
s2_fast_forward(4, s2->root);;
}
tcp = tport_ref(m->tport);
......@@ -695,7 +695,7 @@ START_TEST(register_1_3_3_1)
su_root_step(s2->root, 5);
su_root_step(s2->root, 5);
su_root_step(s2->root, 5);
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
}
......
......@@ -1054,11 +1054,11 @@ START_TEST(call_2_3_1)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
ack = invite_timer_round(nh, "300;refresher=uac", rr);
fail_if(ack->sip->sip_route &&
su_strmatch(ack->sip->sip_route->r_url->url_user, "record"));
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300;refresher=uac", NULL);
bye_by_nua(nh, TAG_END());
......@@ -1082,9 +1082,9 @@ START_TEST(call_2_3_2)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
bye_by_nua(nh, TAG_END());
......@@ -1551,7 +1551,7 @@ START_TEST(call_2_6_2)
/* We get nua_r_invite with 100 trying (and 500 in sip->sip_status) */
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(10);
s2_fast_forward(10, s2->root);;
fail_unless(s2_check_callstate(nua_callstate_calling));
......@@ -1605,7 +1605,7 @@ START_TEST(call_2_6_3)
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
s2_fast_forward(10);
s2_fast_forward(10, s2->root);;
nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
fail_unless(s2_check_event(nua_r_set_params, 200));
......@@ -1752,7 +1752,7 @@ START_TEST(call_3_1_2)
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
fail_unless(s2_check_event(nua_r_invite, 500));
......@@ -1822,7 +1822,7 @@ START_TEST(call_3_2_2)
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
fail_unless(s2_check_event(nua_r_invite, 500));
......@@ -2344,7 +2344,7 @@ START_TEST(bye_4_2_1)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
nua_bye(nh, TAG_END());
......@@ -2357,7 +2357,7 @@ START_TEST(bye_4_2_1)
s2_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
bye = s2_wait_for_request(SIP_METHOD_BYE);
......@@ -2388,10 +2388,10 @@ START_TEST(bye_4_2_2)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
s2_fast_forward(140);
s2_fast_forward(140, s2->root);;
nua_bye(nh, TAG_END());
......@@ -2403,7 +2403,7 @@ START_TEST(bye_4_2_2)
s2_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
s2_fast_forward(160);
s2_fast_forward(160, s2->root);;
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
bye = s2_wait_for_request(SIP_METHOD_BYE);
......
......@@ -290,7 +290,7 @@ START_TEST(subscribe_6_1_2)
s2_free_event(notify);
/* Wait for refresh */
s2_fast_forward(600);
s2_fast_forward(600, s2->root);;
subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
s2_respond_to(subscribe, dialog, SIP_200_OK,
SIPTAG_EXPIRES_STR("600"),
......@@ -377,7 +377,7 @@ START_TEST(subscribe_6_1_4)
su_home_unref((void *)dialog), dialog = su_home_new(sizeof *dialog); fail_if(!dialog);
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
/* nua re-establishes the subscription */
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
......@@ -460,7 +460,7 @@ START_TEST(fetch_6_2_3)
fail_unless(s2_check_substate(event, nua_substate_embryonic));
s2_free_event(event);
s2_fast_forward(600);
s2_fast_forward(600, s2->root);;
event = s2_wait_for_event(nua_i_notify, 408); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
......
......@@ -108,27 +108,6 @@ char const s2_auth3_credentials[] = "Digest:\"s2test3\":abc:abc";
int s2_nua_thread = 0;
/* -- Delay scenarios --------------------------------------------------- */
static unsigned long time_offset;
extern void (*_su_time)(su_time_t *tv);
static void _su_time_fast_forwarder(su_time_t *tv)
{
tv->tv_sec += time_offset;
}
void s2_fast_forward(unsigned long seconds)
{
if (_su_time == NULL)
_su_time = _su_time_fast_forwarder;
time_offset += seconds;
su_root_step(s2->root, 0);
}
/* -- NUA events -------------------------------------------------------- */
struct event *s2_remove_event(struct event *e)
......
......@@ -32,6 +32,8 @@
#include <sofia-sip/tport.h>
#include <sofia-sip/nua.h>
#include "s2util.h"
struct tester
{
su_home_t home[1];
......@@ -119,8 +121,6 @@ extern char const s2_auth3_credentials[];
extern int s2_nua_thread;
void s2_fast_forward(unsigned long seconds);
void s2_case(char const *tag,
char const *title,
char const *description);
......
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