#include <bin/lttng-sessiond/session.h>
#include <common/sessiond-comm/sessiond-comm.h>
+#include <common/common.h>
#include "utils.h"
return -1;
}
+static int session_list_count(void)
+{
+ int count = 0;
+ struct ltt_session *iter;
+
+ cds_list_for_each_entry(iter, &session_list->head, list) {
+ count++;
+ }
+ return count;
+}
+
/*
* Empty session list manually.
*/
cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) {
cds_list_del(&iter->list);
- session_list->count--;
free(iter);
}
/* Session list must be 0 */
- assert(!session_list->count);
+ assert(!session_list_count());
}
/*
int ret;
ret = session_create(name, path, geteuid(), getegid());
- if (ret == LTTCOMM_OK) {
+ if (ret == LTTNG_OK) {
/* Validate */
ret = find_session_name(name);
if (ret < 0) {
return 0;
}
} else {
- if (ret == LTTCOMM_EXIST_SESS) {
+ if (ret == LTTNG_ERR_EXIST_SESS) {
printf("(session already exists) ");
}
return -1;
ret = session_destroy(session);
- if (ret == LTTCOMM_OK) {
+ if (ret == LTTNG_OK) {
/* Validate */
if (session == NULL) {
return 0;
return -1;
}
- ret = create_one_session(SESSION1, NULL);
- if (ret > 0) {
- printf("Session created with %s, (null)\n", SESSION1);
- return -1;
- }
-
/* Session list must be 0 */
- assert(!session_list->count);
-
- return 0;
-}
-
-static int fuzzing_destroy_args(void)
-{
- int ret;
-
- ret = destroy_one_session(NULL);
- if (ret > 0) {
- printf("Session destroyed with (null)\n");
- return -1;
- }
-
- /* Session list must be 0 */
- assert(!session_list->count);
+ assert(!session_list_count());
return 0;
}
static int two_session_same_name(void)
{
int ret;
+ struct ltt_session *sess;
ret = create_one_session(SESSION1, PATH1);
if (ret < 0) {
return -1;
}
- ret = create_one_session(SESSION1, PATH1);
- if (ret < 0) {
+ sess = session_find_by_name(SESSION1);
+ if (sess) {
/* Success */
return 0;
}
}
PRINT_OK();
- printf("Fuzzing destroy_session argument: ");
- fflush(stdout);
- ret = fuzzing_destroy_args();
- if (ret < 0) {
- return -1;
- }
- PRINT_OK();
-
printf("Creating %d sessions: ", MAX_SESSIONS);
fflush(stdout);
for (i = 0; i < MAX_SESSIONS; i++) {
PRINT_OK();
/* Session list must be 0 */
- assert(!session_list->count);
+ assert(!session_list_count());
/* Success */
return 0;