Fix: Tests: test_session.c: Structurally dead code
[lttng-tools.git] / tests / unit / test_session.c
index 991b1dca3de4e71d69d038bab9469bbef402af6c..b538bddc6bac261ca2a6615d065ebcce11b71126 100644 (file)
@@ -132,7 +132,7 @@ static int create_one_session(char *name)
        struct ltt_session *session = NULL;
 
        session_lock_list();
-       ret_code = session_create(name, geteuid(), getegid(), &session);
+       ret_code = session_create(name, geteuid(), getegid(), NULL, &session);
        session_put(session);
        if (ret_code == LTTNG_OK) {
                /* Validate */
@@ -141,21 +141,17 @@ static int create_one_session(char *name)
                        /* Session not found by name */
                        printf("session not found after creation\n");
                        ret = -1;
-                       goto end;
                } else {
                        /* Success */
                        ret = 0;
-                       goto end;
                }
        } else {
                if (ret_code == LTTNG_ERR_EXIST_SESS) {
                        printf("(session already exists) ");
                }
                ret = -1;
-               goto end;
        }
-       ret = 0;
-end:
+
        session_unlock_list();
        return ret;
 }
@@ -269,9 +265,13 @@ void test_destroy_session(void)
        ok(tmp != NULL,
           "Destroying session: session found");
 
-       ok(destroy_one_session(tmp) == 0,
-          "Destroying session: %s destroyed",
-          SESSION1);
+       if (tmp) {
+               ok(destroy_one_session(tmp) == 0,
+                  "Destroying session: %s destroyed",
+                  SESSION1);
+       } else {
+               skip(1, "Skipping session destruction as it was not found");
+       }
        session_unlock_list();
 }
 
@@ -288,7 +288,7 @@ void test_session_name_generation(void)
        const char *expected_session_name_prefix = DEFAULT_SESSION_NAME;
 
        session_lock_list();
-       ret_code = session_create(NULL, geteuid(), getegid(), &session);
+       ret_code = session_create(NULL, geteuid(), getegid(), NULL, &session);
        ok(ret_code == LTTNG_OK,
                "Create session with a NULL name (auto-generate a name)");
        if (!session) {
This page took 0.025762 seconds and 5 git commands to generate.