+static void test_create_ust_event_exclusion(void)
+{
+ struct ltt_ust_event *event;
+ struct lttng_event ev;
+ char *name;
+ struct lttng_event_exclusion *exclusion;
+
+ memset(&ev, 0, sizeof(ev));
+
+ /* make a wildcarded event name */
+ name = get_random_string();
+ name[strlen(name) - 1] = '*';
+ strncpy(ev.name, name, LTTNG_SYMBOL_NAME_LEN);
+
+ ev.type = LTTNG_EVENT_TRACEPOINT;
+ ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
+
+ /* set up an exclusion set */
+ exclusion = zmalloc(sizeof(*exclusion) + LTTNG_SYMBOL_NAME_LEN);
+ if (!exclusion) {
+ PERROR("zmalloc");
+ }
+
+ ok(exclusion != NULL, "Create UST exclusion");
+
+ exclusion->count = 1;
+ strncpy((char *)(exclusion->names), get_random_string(), LTTNG_SYMBOL_NAME_LEN);
+
+ event = trace_ust_create_event(&ev, NULL, NULL, exclusion, false);
+
+ ok(event != NULL, "Create UST event with exclusion");
+
+ ok(event->enabled == 0 &&
+ event->attr.instrumentation == LTTNG_UST_TRACEPOINT &&
+ strcmp(event->attr.name, ev.name) == 0 &&
+ event->exclusion != NULL &&
+ event->exclusion->count == 1 &&
+ strcmp((char *)(event->exclusion->names), (char *)(exclusion->names)) == 0 &&
+ event->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] == '\0',
+ "Validate UST event and exclusion");
+
+ trace_ust_destroy_event(event);
+}
+
+