X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Ftest_sessions.c;h=01a54b3ce27eb0d91b09992d7a3aae0f36d1c359;hb=67f747d8095da3f240f71e33c4a1eb0f84aa5e41;hp=8ea365fed684f5d2ee09d08d79ab3400390ee8a2;hpb=54d01ffb43587b221dc50ec42b6070fad89bd255;p=lttng-tools.git diff --git a/tests/test_sessions.c b/tests/test_sessions.c index 8ea365fed..01a54b3ce 100644 --- a/tests/test_sessions.c +++ b/tests/test_sessions.c @@ -24,9 +24,11 @@ #include #include #include +#include #include -#include "ltt-sessiond/session.h" + +#include #include "utils.h" #define SESSION1 "test1" @@ -117,7 +119,7 @@ static int create_one_session(char *name, char *path) { int ret; - ret = session_create(name, path); + ret = session_create(name, path, geteuid(), getegid()); if (ret == LTTCOMM_OK) { /* Validate */ ret = find_session_name(name); @@ -142,15 +144,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 +206,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 +265,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 +273,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 +317,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;