Skip to content

Commit

Permalink
lib-http: test-http-payload: Improved logging of nested ioloop tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch committed Sep 13, 2016
1 parent 5bfda55 commit 19f8621
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/lib-http/test-http-payload.c
Expand Up @@ -40,6 +40,7 @@ static pid_t server_pid = (pid_t)-1;
static struct ioloop *ioloop_nested = NULL;
static unsigned ioloop_nested_first = 0;
static unsigned ioloop_nested_last = 0;
static unsigned ioloop_nested_depth = 0;

/*
* Test files
Expand Down Expand Up @@ -1132,10 +1133,12 @@ static void test_client_echo_continue(void)
ioloop_nested_last = client_files_last;

if (debug) {
i_debug("test client: echo: entering ioloop for %u...%u",
ioloop_nested_first, ioloop_nested_last);
i_debug("test client: echo: entering ioloop for %u...%u (depth=%u)",
ioloop_nested_first, ioloop_nested_last, ioloop_nested_depth);
}

ioloop_nested_depth++;

ioloop_nested = io_loop_create();
http_client_switch_ioloop(http_client);
test_client_requests_switch_ioloop();
Expand All @@ -1149,9 +1152,11 @@ static void test_client_echo_continue(void)
io_loop_destroy(&ioloop_nested);
ioloop_nested = NULL;

ioloop_nested_depth--;

if (debug) {
i_debug("test client: echo: leaving ioloop for %u...%u",
ioloop_nested_first, ioloop_nested_last);
i_debug("test client: echo: leaving ioloop for %u...%u (depth=%u)",
ioloop_nested_first, ioloop_nested_last, ioloop_nested_depth);
}
ioloop_nested_first = ioloop_nested_last = 0;
}
Expand Down Expand Up @@ -1217,6 +1222,7 @@ static void test_run_client_server(
i_debug("server: PID=%s", my_pid);
/* child: server */
ioloop_nested = NULL;
ioloop_nested_depth = 0;
ioloop = io_loop_create();
test_server_init(server_set);
io_loop_run(ioloop);
Expand All @@ -1229,6 +1235,7 @@ static void test_run_client_server(
i_close_fd(&fd_listen);
/* parent: client */
ioloop_nested = NULL;
ioloop_nested_depth = 0;
ioloop = io_loop_create();
client_init(client_set);
io_loop_run(ioloop);
Expand Down

0 comments on commit 19f8621

Please sign in to comment.