X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ftrigger%2Futils%2Fnotification-client.c;h=11e9206964b80974dffbabbf1e77d30afa61eb3f;hb=f250b40e2179eccdb83766bf4abef5a35036c47b;hp=904d7e5650c90661bf3dfa524cb837ce266c58c2;hpb=6ffce1f5bbc5c3e956bc91ce801c779588bf37af;p=lttng-tools.git diff --git a/tests/regression/tools/trigger/utils/notification-client.c b/tests/regression/tools/trigger/utils/notification-client.c index 904d7e565..11e920696 100644 --- a/tests/regression/tools/trigger/utils/notification-client.c +++ b/tests/regression/tools/trigger/utils/notification-client.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include "utils.h" @@ -36,22 +36,22 @@ static struct option long_options[] = {0, 0, 0, 0} }; -static bool action_group_contains_notify( - const struct lttng_action *action_group) +static bool action_list_contains_notify( + const struct lttng_action *action_list) { unsigned int i, count; enum lttng_action_status status = - lttng_action_group_get_count(action_group, &count); + lttng_action_list_get_count(action_list, &count); if (status != LTTNG_ACTION_STATUS_OK) { - printf("Failed to get action count from action group\n"); + printf("Failed to get action count from action list\n"); exit(1); } for (i = 0; i < count; i++) { const struct lttng_action *action = - lttng_action_group_get_at_index( - action_group, i); + lttng_action_list_get_at_index( + action_list, i); const enum lttng_action_type action_type = lttng_action_get_type(action); @@ -62,6 +62,7 @@ static bool action_group_contains_notify( return false; } +/* Only expects named triggers. */ static bool is_trigger_name(const char *expected_trigger_name, struct lttng_notification *notification) { @@ -98,8 +99,8 @@ int main(int argc, char **argv) int ret; int option; int option_index; - const char *expected_trigger_name = NULL; - const char *end_trigger_name = NULL; + char *expected_trigger_name = NULL; + char *end_trigger_name = NULL; struct lttng_triggers *triggers = NULL; unsigned int count, i, subcription_count = 0; enum lttng_trigger_status trigger_status; @@ -172,16 +173,16 @@ int main(int argc, char **argv) const char *trigger_name = NULL; lttng_trigger_get_name(trigger, &trigger_name); - if (strcmp(trigger_name, expected_trigger_name)) { + if (strcmp(trigger_name, expected_trigger_name) != 0) { /* Might match the end event trigger */ if (end_trigger_name != NULL && strcmp(trigger_name, - end_trigger_name)) { + end_trigger_name) != 0) { continue; } } - if (!((action_type == LTTNG_ACTION_TYPE_GROUP && - action_group_contains_notify(action)) || + if (!((action_type == LTTNG_ACTION_TYPE_LIST && + action_list_contains_notify(action)) || action_type == LTTNG_ACTION_TYPE_NOTIFY)) { /* "The action of trigger is not notify, skipping. */ continue; @@ -240,7 +241,6 @@ int main(int argc, char **argv) break; case LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED: printf("Notification channel was closed by peer.\n"); - ret = -1; break; default: fprintf(stderr, "A communication error occurred on the notification channel.\n"); @@ -295,5 +295,8 @@ evaluate_success: end: lttng_triggers_destroy(triggers); lttng_notification_channel_destroy(notification_channel); + free(after_notif_register_file_path); + free(end_trigger_name); + free(expected_trigger_name); return !!ret; }