X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Ftest_sessions.c;h=3e45c21b669563846e41dbfd0e624496cf95b9df;hp=8ea365fed684f5d2ee09d08d79ab3400390ee8a2;hb=038238aa959d8e8e8b7c465024ca37599fcc4056;hpb=54d01ffb43587b221dc50ec42b6070fad89bd255 diff --git a/tests/test_sessions.c b/tests/test_sessions.c index 8ea365fed..3e45c21b6 100644 --- a/tests/test_sessions.c +++ b/tests/test_sessions.c @@ -26,7 +26,8 @@ #include #include -#include "ltt-sessiond/session.h" + +#include #include "utils.h" #define SESSION1 "test1" @@ -142,15 +143,18 @@ static int create_one_session(char *name, char *path) /* * Test deletion of 1 session */ -static int destroy_one_session(char *name) +static int destroy_one_session(struct ltt_session *session) { int ret; - ret = session_destroy(name); + ret = session_destroy(session); if (ret == LTTCOMM_OK) { /* Validate */ - ret = find_session_name(name); + if (session == NULL) { + return 0; + } + ret = find_session_name(session->name); if (ret < 0) { /* Success, -1 means that the sesion is NOT found */ return 0; @@ -201,12 +205,6 @@ static int fuzzing_destroy_args(void) return -1; } - ret = destroy_one_session(OVERFLOW_SESSION_NAME); - if (ret > 0) { - printf("Session destroyed with %s\n", OVERFLOW_SESSION_NAME); - return -1; - } - /* Session list must be 0 */ assert(!session_list->count); @@ -266,7 +264,6 @@ int main(int argc, char **argv) } /* Basic init session values */ assert(tmp->kernel_session == NULL); - assert(tmp->ust_session_list.count == 0); assert(strlen(tmp->path)); assert(strlen(tmp->name)); session_lock(tmp); @@ -275,7 +272,7 @@ int main(int argc, char **argv) PRINT_OK(); printf("Destroy 1 session %s: ", SESSION1); - ret = destroy_one_session(SESSION1); + ret = destroy_one_session(tmp); if (ret < 0) { return -1; } @@ -319,7 +316,7 @@ int main(int argc, char **argv) printf("Destroying %d sessions: ", MAX_SESSIONS); for (i = 0; i < MAX_SESSIONS; i++) { cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) { - ret = destroy_one_session(iter->name); + ret = destroy_one_session(iter); if (ret < 0) { printf("session %d (name: %s) creation failed\n", i, iter->name); return -1;