test: delete default loop after test run

Delete the default event loop after the test completes. Keeps valgrind happy.
This commit is contained in:
Ben Noordhuis 2012-09-30 23:41:03 +02:00
parent 4e268f7718
commit f090297f62
3 changed files with 7 additions and 5 deletions

View File

@ -415,7 +415,6 @@ static int test_tcp(unsigned int num_servers, unsigned int num_clients) {
free(clients);
free(servers);
uv_loop_delete(uv_default_loop()); /* Silence valgrind. */
return 0;
}

View File

@ -24,6 +24,7 @@
#include "runner.h"
#include "task.h"
#include "uv.h"
char executable_path[PATHMAX] = { '\0' };
@ -293,11 +294,14 @@ out:
*/
int run_test_part(const char* test, const char* part) {
task_entry_t* task;
int r;
for (task = TASKS; task->main; task++) {
if (strcmp(test, task->task_name) == 0
&& strcmp(part, task->process_name) == 0) {
return task->main();
if (strcmp(test, task->task_name) == 0 &&
strcmp(part, task->process_name) == 0) {
r = task->main();
uv_loop_delete(uv_default_loop());
return r;
}
}

View File

@ -140,7 +140,6 @@ TEST_IMPL(fs_poll) {
ASSERT(poll_cb_called == 5);
ASSERT(timer_cb_called == 2);
ASSERT(close_cb_called == 1);
uv_loop_delete(loop);
return 0;
}