- ok(create_one_session(NULL, NULL) < 0,
- "Create session with bogus param: NULL, NULL should fail");
-
- ok(create_one_session(NULL, PATH1) < 0,
- "Create session with bogus param: NULL, %s should fail",
- PATH1);
-
- ok(session_list_count() == 0,
- "Create session with bogus param: session list empty");
+ struct ltt_session *session = NULL;
+ enum lttng_error_code ret_code;
+ const char *expected_session_name_prefix = DEFAULT_SESSION_NAME;
+
+ session_lock_list();
+ ret_code = session_create(NULL, geteuid(), getegid(), &session);
+ ok(ret_code == LTTNG_OK,
+ "Create session with a NULL name (auto-generate a name)");
+ if (!session) {
+ skip(1, "Skipping session name generation tests as session_create() failed.");
+ goto end;
+ }
+ diag("Automatically-generated session name: %s", *session->name ?
+ session->name : "ERROR");
+ ok(*session->name && !strncmp(expected_session_name_prefix, session->name,
+ sizeof(DEFAULT_SESSION_NAME) - 1),
+ "Auto-generated session name starts with %s",
+ DEFAULT_SESSION_NAME);
+end:
+ session_put(session);
+ session_unlock_list();