+
+ /*
+ * Test subscription and unsubscription to/from a channel with invalid
+ * parameters.
+ */
+ nc_status = lttng_notification_channel_subscribe(NULL, NULL);
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
+ "Notification channel subscription is invalid: NULL, NULL");
+
+ nc_status = lttng_notification_channel_subscribe(
+ notification_channel, NULL);
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
+ "Notification channel subscription is invalid: NON-NULL, NULL");
+
+ nc_status = lttng_notification_channel_subscribe(NULL, dummy_condition);
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
+ "Notification channel subscription is invalid: NULL, NON-NULL");
+
+ nc_status = lttng_notification_channel_unsubscribe(
+ notification_channel, dummy_condition);
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION,
+ "Unsubscribing from a valid unknown condition");
+
+end:
+ lttng_notification_channel_destroy(notification_channel);
+ lttng_condition_destroy(dummy_invalid_condition);
+ lttng_condition_destroy(dummy_condition);
+ return;
+}
+
+static void test_notification_channel(const char *session_name,
+ const char *channel_name,
+ const enum lttng_domain_type domain_type,
+ const char **argv)
+{
+ int ret = 0;
+ enum lttng_condition_status condition_status;
+ enum lttng_notification_channel_status nc_status;
+
+ struct lttng_action *action = NULL;
+ struct lttng_notification *notification = NULL;
+ struct lttng_notification_channel *notification_channel = NULL;
+ struct lttng_trigger *trigger = NULL;
+
+ struct lttng_condition *low_condition = NULL;
+ struct lttng_condition *high_condition = NULL;
+
+ double low_ratio = 0.0;
+ double high_ratio = 0.90;
+
+ /* Set-up */
+ action = lttng_action_notify_create();
+ if (!action) {
+ fail("Setup error on action creation");