static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_condition)
{
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_condition)
{
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Domain name is unset");
diag("Testing session name set/get");
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Domain name is unset");
diag("Testing session name set/get");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get session name with null condition");
ok(!session_name, "Session name is null");
status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get session name with null condition");
ok(!session_name, "Session name is null");
status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
ok(!session_name, "Session name is null");
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
ok(!session_name, "Session name is null");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null session name");
status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
&session_name);
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null session name");
status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
&session_name);
ok(strcmp("session420", session_name) == 0, "Session is still name is %s", "session420");
diag("Testing channel name set/get");
ok(strcmp("session420", session_name) == 0, "Session is still name is %s", "session420");
diag("Testing channel name set/get");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get channel name with null condition");
status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
&channel_name);
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
ok(!channel_name, "Channel name is null");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get channel name with null condition");
status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
&channel_name);
ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
ok(!channel_name, "Channel name is null");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null channel name");
status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
&channel_name);
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null channel name");
status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
&channel_name);
ok(strcmp("channel420", channel_name) == 0, "Channel is still name is %s", "channel420");
diag("Testing threshold ratio set/get");
ok(strcmp("channel420", channel_name) == 0, "Channel is still name is %s", "channel420");
diag("Testing threshold ratio set/get");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold ratio with null condition");
status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
&threshold_ratio);
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold ratio with null condition");
status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
&threshold_ratio);
ok(threshold_ratio == 0.420, "Threshold ratio is 0.420");
diag("Testing threshold bytes set/get");
ok(threshold_ratio == 0.420, "Threshold ratio is 0.420");
diag("Testing threshold bytes set/get");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold value with null condition ");
status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
&threshold_bytes);
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold value with null condition ");
status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
&threshold_bytes);
ok(threshold_bytes == 420, "Threshold is untouched");
diag("Testing domain type set/get");
ok(threshold_bytes == 420, "Threshold is untouched");
diag("Testing domain type set/get");
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get domain type with null condition");
status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition,
ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get domain type with null condition");
status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition,
diag("Testing lttng_condition_buffer_usage_low_create");
buffer_usage_low = lttng_condition_buffer_usage_low_create();
diag("Testing lttng_condition_buffer_usage_low_create");
buffer_usage_low = lttng_condition_buffer_usage_low_create();
diag("Testing lttng_condition_buffer_usage_high_create");
buffer_usage_high = lttng_condition_buffer_usage_high_create();
diag("Testing lttng_condition_buffer_usage_high_create");
buffer_usage_high = lttng_condition_buffer_usage_high_create();
- struct lttng_action *notify_action = NULL;
- struct lttng_condition *buffer_usage_high = NULL;
- struct lttng_trigger *trigger = NULL;
+ struct lttng_action *notify_action = nullptr;
+ struct lttng_condition *buffer_usage_high = nullptr;
+ struct lttng_trigger *trigger = nullptr;
notify_action = lttng_action_notify_create();
buffer_usage_high = lttng_condition_buffer_usage_high_create();
notify_action = lttng_action_notify_create();
buffer_usage_high = lttng_condition_buffer_usage_high_create();
ok(!trigger, "lttng_trigger_create(NULL, NON-NULL) returns null");
trigger = lttng_trigger_create(buffer_usage_high, notify_action);
ok(!trigger, "lttng_trigger_create(NULL, NON-NULL) returns null");
trigger = lttng_trigger_create(buffer_usage_high, notify_action);