- condition_status = lttng_condition_buffer_usage_set_session_name(
- low_condition, session_name);
- if (condition_status != LTTNG_CONDITION_STATUS_OK) {
- fail("Setup error on low_condition creation");
- goto end;
- }
- condition_status = lttng_condition_buffer_usage_set_channel_name(
- low_condition, channel_name);
- if (condition_status != LTTNG_CONDITION_STATUS_OK) {
- fail("Setup error on low_condition creation");
- goto end;
+ 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;
+}
+
+enum buffer_usage_type {
+ BUFFER_USAGE_TYPE_LOW,
+ BUFFER_USAGE_TYPE_HIGH,
+};
+
+static int register_buffer_usage_notify_trigger(const char *session_name,
+ const char *channel_name,
+ const enum lttng_domain_type domain_type,
+ enum buffer_usage_type buffer_usage_type,
+ double ratio,
+ struct lttng_condition **condition,
+ struct lttng_action **action,
+ struct lttng_trigger **trigger)
+{
+ enum lttng_condition_status condition_status;
+ struct lttng_action *tmp_action = NULL;
+ struct lttng_condition *tmp_condition = NULL;
+ struct lttng_trigger *tmp_trigger = NULL;
+ int ret = 0;
+
+ /* Set-up */
+ tmp_action = lttng_action_notify_create();
+ if (!action) {
+ fail("Setup error on action creation");
+ ret = -1;
+ goto error;