Commit 40a4d1ec authored by Pekka Pessi's avatar Pekka Pessi

test_nua: added --log option for logging messages from a certain endpoint only.

darcs-hash:20070124152825-65a35-85313abfc1c4a05a84c10b95c873463fcedc96ee.gz
parent 5f44484c
......@@ -35,6 +35,8 @@
#include "test_nua.h"
#include <sofia-sip/tport_tag.h>
#if HAVE_FUNC
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
......@@ -109,6 +111,7 @@ int test_nua_init(struct context *ctx,
AUTHTAG_DB(passwd_name),
AUTHTAG_QOP("auth-int"),
AUTHTAG_ALGORITHM("md5-sess"),
TAG_IF(ctx->proxy_logging, TPTAG_LOG(1)),
TAG_END());
ctx->proxy_tests = ctx->p != NULL;
......@@ -223,6 +226,7 @@ int test_nua_init(struct context *ctx,
SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8"),
NTATAG_SIP_T1X64(4000),
NUTAG_INSTANCE(ctx->a.instance),
TAG_IF(ctx->a.logging, TPTAG_LOG(1)),
TAG_END());
TEST_1(ctx->a.nua);
......@@ -258,6 +262,7 @@ int test_nua_init(struct context *ctx,
NUTAG_URL("sip:0.0.0.0:*"),
SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),
NUTAG_INSTANCE(ctx->b.instance),
TAG_IF(ctx->b.logging, TPTAG_LOG(1)),
TAG_END());
TEST_1(ctx->b.nua);
......@@ -294,6 +299,7 @@ int test_nua_init(struct context *ctx,
NUTAG_URL("sip:0.0.0.0:*"),
SOATAG_USER_SDP_STR("m=audio 5400 RTP/AVP 8 0"),
NUTAG_INSTANCE(ctx->c.instance),
TAG_IF(ctx->c.logging, TPTAG_LOG(1)),
TAG_END());
TEST_1(ctx->c.nua);
......
......@@ -79,6 +79,10 @@ static char const options_usage[] =
" -A print nua events for A\n"
" -B print nua events for B\n"
" -C print nua events for C\n"
" --log=a log messages for A\n"
" --log=b log messages for B\n"
" --log=c log messages for C\n"
" --log=proxy log messages for proxy\n"
" --attach print pid, wait for a debugger to be attached\n"
" --no-proxy do not use internal proxy\n"
" --no-nat do not use internal \"nat\"\n"
......@@ -204,6 +208,18 @@ int main(int argc, char *argv[])
else if (strcmp(argv[i], "--loop") == 0) {
o_alarm = 0, o_loop = 1;
}
else if (strcmp(argv[i], "--log=a") == 0) {
ctx->a.logging = 1;
}
else if (strcmp(argv[i], "--log=b") == 0) {
ctx->b.logging = 1;
}
else if (strcmp(argv[i], "--log=c") == 0) {
ctx->c.logging = 1;
}
else if (strcmp(argv[i], "--log=proxy") == 0) {
ctx->proxy_logging = 1;
}
#if SU_HAVE_OSX_CF_API /* If compiled with CoreFoundation events */
else if (strcmp(argv[i], "--osx-runloop") == 0) {
ctx->osx_runloop = 1;
......
......@@ -126,10 +126,14 @@ struct context
int threading, proxy_tests, expensive, quit_on_single_failure, osx_runloop;
char const *external_proxy;
int proxy_logging;
struct endpoint {
char name[4];
struct context *ctx; /* Backpointer */
int logging;
int running;
condition_function *next_condition;
......
......@@ -230,7 +230,7 @@ test_proxy_init(su_root_t *root, struct proxy *proxy)
NTATAG_UA(0),
NTATAG_SERVER_RPORT(1),
NTATAG_CLIENT_RPORT(1),
TAG_END());
TAG_NEXT(proxy->tags));
proxy->transport_contacts = create_transport_contacts(proxy);
......@@ -308,7 +308,7 @@ test_proxy_deinit(su_root_t *root, struct proxy *proxy)
free(proxy->tags);
}
/* Create tst proxy object */
/* Create test proxy object */
struct proxy *test_proxy_create(su_root_t *root,
tag_type_t tag, tag_value_t value, ...)
{
......
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