on-event evaluation: remove trigger name accessor
[lttng-tools.git] / tests / regression / tools / notification / notification.c
index 0f1a418112eefedb41401b5c89174b3c9baf4feb..e26c99d033129940128584bca9bcb7b9d18a597f 100644 (file)
@@ -579,33 +579,24 @@ struct capture_base_field_tuple test_capture_base_fields[] = {
 static const char *get_notification_trigger_name(
                struct lttng_notification *notification)
 {
-       const char *name = NULL;
-       enum lttng_evaluation_status status;
-       const struct lttng_evaluation *evaluation;
-       evaluation = lttng_notification_get_evaluation(notification);
-       if (evaluation == NULL) {
-               fail("lttng_notification_get_evaluation");
+       const char *trigger_name = NULL;
+       enum lttng_trigger_status trigger_status;
+       const struct lttng_trigger *trigger;
+
+       trigger = lttng_notification_get_trigger(notification);
+       if (!trigger) {
+               fail("Failed to get trigger from notification");
                goto end;
        }
 
-       switch (lttng_evaluation_get_type(evaluation)) {
-       case LTTNG_CONDITION_TYPE_ON_EVENT:
-       {
-               status = lttng_evaluation_on_event_get_trigger_name(
-                               evaluation, &name);
-               if (status != LTTNG_EVALUATION_STATUS_OK) {
-                       fail("lttng_evaluation_on_event_get_trigger_name");
-                       name = NULL;
-                       goto end;
-               }
-               break;
-       }
-       default:
-               fail("Wrong notification evaluation type \n");
+       trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
+       if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
+               fail("Failed to get name from notification's trigger");
                goto end;
        }
+
 end:
-       return name;
+       return trigger_name;
 }
 
 static int validator_notification_trigger_name(
@@ -1864,14 +1855,9 @@ static void test_kprobe_event_rule_notification(
                        lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       event_rule = lttng_event_rule_kernel_probe_create();
+       event_rule = lttng_event_rule_kernel_probe_create(location);
        ok(event_rule, "kprobe event rule object creation");
 
-       event_rule_status = lttng_event_rule_kernel_probe_set_location(
-                       event_rule, location);
-       ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting kprobe event rule location: '%s'", symbol_name);
-
        event_rule_status = lttng_event_rule_kernel_probe_set_event_name(
                        event_rule, trigger_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
@@ -1978,15 +1964,10 @@ static void test_uprobe_event_rule_notification(
                        lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       event_rule = lttng_event_rule_userspace_probe_create();
+       event_rule = lttng_event_rule_userspace_probe_create(probe_location);
        ok(event_rule, "kprobe event rule object creation");
 
-       event_rule_status = lttng_event_rule_userspace_probe_set_location(
-                       event_rule, probe_location);
-       ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting uprobe event rule location");
-
-       event_rule_status = lttng_event_rule_userspace_probe_set_name(
+       event_rule_status = lttng_event_rule_userspace_probe_set_event_name(
                        event_rule, trigger_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
                        "Setting uprobe event rule name: '%s'", trigger_name);
@@ -2316,7 +2297,7 @@ static int validator_notification_trigger_capture(
 {
        int ret;
        unsigned int capture_count, i;
-       enum lttng_evaluation_status evaluation_status;
+       enum lttng_evaluation_on_event_status on_event_evaluation_status;
        enum lttng_event_field_value_status event_field_value_status;
        const struct lttng_evaluation *evaluation;
        const struct lttng_event_field_value *captured_fields;
@@ -2329,11 +2310,12 @@ static int validator_notification_trigger_capture(
                goto end;
        }
 
-       evaluation_status = lttng_evaluation_on_event_get_captured_values(
-                       evaluation, &captured_fields);
-       if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) {
+       on_event_evaluation_status =
+                       lttng_evaluation_on_event_get_captured_values(
+                                       evaluation, &captured_fields);
+       if (on_event_evaluation_status != LTTNG_EVALUATION_ON_EVENT_STATUS_OK) {
                diag("Failed to get event rule evaluation captured values: status = %d",
-                               (int) evaluation_status);
+                               (int) on_event_evaluation_status);
                ret = 1;
                goto end;
        }
@@ -2600,7 +2582,7 @@ int main(int argc, const char *argv[])
        }
        case 4:
        {
-               plan_tests(13);
+               plan_tests(12);
                /* Test cases that need the kernel tracer. */
                assert(domain_type == LTTNG_DOMAIN_KERNEL);
 
@@ -2633,7 +2615,7 @@ int main(int argc, const char *argv[])
        {
                const char *testapp_path, *test_symbol_name;
 
-               plan_tests(13);
+               plan_tests(12);
 
                if (argc < 7) {
                        fail("Missing parameter for tests to run %d", argc);
This page took 0.024977 seconds and 4 git commands to generate.