summaryrefslogtreecommitdiff
path: root/test/birdtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/birdtest.c')
-rw-r--r--test/birdtest.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/birdtest.c b/test/birdtest.c
index 6ad743ce..5e3de1c5 100644
--- a/test/birdtest.c
+++ b/test/birdtest.c
@@ -20,6 +20,8 @@
#include "test/birdtest.h"
#include "lib/string.h"
+#include "lib/event.h"
+#include "lib/io-loop.h"
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
@@ -63,6 +65,9 @@ bt_init(int argc, char *argv[])
{
int c;
+ /* We have no interest in stdin */
+ close(0);
+
initstate(BT_RANDOM_SEED, (char *) bt_random_state, sizeof(bt_random_state));
bt_verbose = 0;
@@ -119,6 +124,11 @@ bt_init(int argc, char *argv[])
clock_gettime(CLOCK_MONOTONIC, &bt_begin);
bt_suite_case_begin = bt_suite_begin = bt_begin;
+ the_bird_lock();
+ resource_init();
+ ev_init_list(&global_event_list, &main_birdloop, "Global event list in unit tests");
+ ev_init_list(&global_work_list, &main_birdloop, "Global work list in unit tests");
+ birdloop_init();
return;
usage:
@@ -172,6 +182,8 @@ int bt_run_test_fn(int (*fn)(const void *), const void *fn_arg, int timeout)
if (!bt_suite_result)
result = 0;
+ tmp_flush();
+
return result;
}
@@ -240,7 +252,7 @@ bt_log_result(int result, u64 time, const char *fmt, va_list argptr)
printf("%s\n", result_str);
if (do_die && !result)
- abort();
+ exit(1);
}
static u64