X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Funit%2Ftest_session.c;h=cfbb52d048dd00820e6817a24dbe221a5a165716;hp=7c925908d326f18443c3e2184a50a8c430abb723;hb=a9577b7628a85b064c3f249c3504bad989848b49;hpb=23324029347bb09d3c7fdc4c9675ba6a33cb2fa9 diff --git a/tests/unit/test_session.c b/tests/unit/test_session.c index 7c925908d..cfbb52d04 100644 --- a/tests/unit/test_session.c +++ b/tests/unit/test_session.c @@ -24,11 +24,14 @@ #include #include #include +#include #include #include #include +#include +#include #include #include @@ -40,7 +43,9 @@ /* Number of TAP tests in this file */ #define NUM_TESTS 11 +struct health_app *health_sessiond; static struct ltt_session_list *session_list; +static pthread_t ht_cleanup_thread; /* For error.h */ int lttng_opt_quiet = 1; @@ -152,7 +157,7 @@ static int destroy_one_session(struct ltt_session *session) int ret; char session_name[NAME_MAX]; - strncpy(session_name, session->name, sizeof(session->name)); + strncpy(session_name, session->name, sizeof(session_name)); session_name[sizeof(session_name) - 1] = '\0'; ret = session_destroy(session); @@ -293,8 +298,13 @@ int main(int argc, char **argv) { plan_tests(NUM_TESTS); + health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES); + assert(!init_ht_cleanup_thread(&ht_cleanup_thread)); + diag("Sessions unit tests"); + rcu_register_thread(); + test_session_list(); test_create_one_session(); @@ -311,5 +321,8 @@ int main(int argc, char **argv) test_large_session_number(); + rcu_unregister_thread(); + assert(!fini_ht_cleanup_thread(&ht_cleanup_thread)); + return exit_status(); }