trace_ust_create_event() now returns an error code
[lttng-tools.git] / tests / unit / test_ust_data.c
index 43ad3115bcd4ae6a4a52616f4b2deefb89a429ce..b80cb5b5402eeb26ca2f67cb301a96d8b4714343 100644 (file)
@@ -63,6 +63,19 @@ static char random_string[RANDOM_STRING_LEN];
 static struct ltt_ust_session *usess;
 static struct lttng_domain dom;
 
+/*
+ * Stub to prevent an undefined reference in this test without having to link
+ * the entire tree because of a cascade of dependencies. This is not used,
+ * it is just there to prevent GCC from complaining.
+ */
+int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain,
+               struct ltt_session *session)
+{
+       ERR("Stub called instead of the real function");
+       abort();
+       return -1;
+}
+
 /*
  * Return random string of 10 characters.
  * Not thread-safe.
@@ -137,6 +150,7 @@ static void test_create_ust_event(void)
 {
        struct ltt_ust_event *event;
        struct lttng_event ev;
+       enum lttng_error_code ret;
 
        memset(&ev, 0, sizeof(ev));
        ok(lttng_strncpy(ev.name, get_random_string(),
@@ -145,9 +159,9 @@ static void test_create_ust_event(void)
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
-       event = trace_ust_create_event(&ev, NULL, NULL, NULL, false);
+       ret = trace_ust_create_event(&ev, NULL, NULL, NULL, false, &event);
 
-       ok(event != NULL, "Create UST event");
+       ok(ret == LTTNG_OK, "Create UST event");
 
        if (!event) {
                skip(1, "UST event is null");
@@ -165,6 +179,7 @@ static void test_create_ust_event(void)
 
 static void test_create_ust_event_exclusion(void)
 {
+       enum lttng_error_code ret;
        struct ltt_ust_event *event;
        struct lttng_event ev;
        char *name;
@@ -199,10 +214,10 @@ static void test_create_ust_event_exclusion(void)
        strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1), random_name,
                LTTNG_SYMBOL_NAME_LEN);
 
-       event = trace_ust_create_event(&ev, NULL, NULL, exclusion, false);
+       ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
        exclusion = NULL;
 
-       ok(!event, "Create UST event with identical exclusion names fails");
+       ok(ret != LTTNG_OK, "Create UST event with identical exclusion names fails");
 
        exclusion = zmalloc(sizeof(*exclusion) +
                LTTNG_SYMBOL_NAME_LEN * exclusion_count);
@@ -218,8 +233,8 @@ static void test_create_ust_event_exclusion(void)
        strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
                get_random_string(), LTTNG_SYMBOL_NAME_LEN);
 
-       event = trace_ust_create_event(&ev, NULL, NULL, exclusion, false);
-       ok(event != NULL, "Create UST event with different exclusion names");
+       ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
+       ok(ret == LTTNG_OK, "Create UST event with different exclusion names");
 
        if (!event) {
                skip(1, "UST event with exclusion is null");
This page took 0.027492 seconds and 5 git commands to generate.