X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Fnotification.c;h=092ac5f1ec5e978fafbdaf89467bf3eb3ac2c6ee;hb=a5c2d2a71919b8d1542b62f6d32579125cc2c8f8;hp=e26c99d033129940128584bca9bcb7b9d18a597f;hpb=65f649784e948615ec369db9eba40847a75ccaf2;p=lttng-tools.git diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index e26c99d03..092ac5f1e 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -590,7 +590,13 @@ static const char *get_notification_trigger_name( } trigger_status = lttng_trigger_get_name(trigger, &trigger_name); - if (trigger_status != LTTNG_TRIGGER_STATUS_OK) { + switch (trigger_status) { + case LTTNG_TRIGGER_STATUS_OK: + break; + case LTTNG_TRIGGER_STATUS_UNSET: + trigger_name = "(anonymous)"; + break; + default: fail("Failed to get name from notification's trigger"); goto end; } @@ -1443,13 +1449,12 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern, struct lttng_trigger **trigger) { enum lttng_event_rule_status event_rule_status; - enum lttng_trigger_status trigger_status; - struct lttng_action *tmp_action = NULL; struct lttng_event_rule *event_rule = NULL; struct lttng_condition *tmp_condition = NULL; struct lttng_trigger *tmp_trigger = NULL; int ret; + enum lttng_error_code ret_code; assert(event_pattern); assert(trigger_name); @@ -1495,7 +1500,7 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern, ok(success, "Setting tracepoint event rule exclusions"); } - tmp_condition = lttng_condition_on_event_create(event_rule); + tmp_condition = lttng_condition_event_rule_matches_create(event_rule); ok(tmp_condition, "Condition event rule object creation"); if (capture_desc_cb) { @@ -1512,12 +1517,8 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern, tmp_trigger = lttng_trigger_create(tmp_condition, tmp_action); ok(tmp_trigger, "Trigger object creation %s", trigger_name); - trigger_status = lttng_trigger_set_name(tmp_trigger, trigger_name); - ok(trigger_status == LTTNG_TRIGGER_STATUS_OK, - "Setting name to trigger %s", trigger_name); - - ret = lttng_register_trigger(tmp_trigger); - ok(ret == 0, "Trigger registration %s", trigger_name); + ret_code = lttng_register_trigger_with_name(tmp_trigger, trigger_name); + ok(ret_code == LTTNG_OK, "Trigger registration %s", trigger_name); lttng_event_rule_destroy(event_rule); @@ -1826,10 +1827,10 @@ static void test_kprobe_event_rule_notification( enum lttng_domain_type domain_type) { int i, ret; + enum lttng_error_code ret_code; const int notification_count = 3; enum lttng_notification_channel_status nc_status; enum lttng_event_rule_status event_rule_status; - enum lttng_trigger_status trigger_status; struct lttng_notification_channel *notification_channel = NULL; struct lttng_condition *condition = NULL; struct lttng_kernel_probe_location *location = NULL; @@ -1863,7 +1864,7 @@ static void test_kprobe_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule name: '%s'", trigger_name); - condition = lttng_condition_on_event_create(event_rule); + condition = lttng_condition_event_rule_matches_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the trigger for condition. */ @@ -1873,12 +1874,8 @@ static void test_kprobe_event_rule_notification( goto end; } - trigger_status = lttng_trigger_set_name(trigger, trigger_name); - ok(trigger_status == LTTNG_TRIGGER_STATUS_OK, - "Setting trigger name to '%s'", trigger_name); - - ret = lttng_register_trigger(trigger); - if (ret) { + ret_code = lttng_register_trigger_with_name(trigger, trigger_name); + if (ret_code != LTTNG_OK) { fail("Failed to register trigger with kernel probe event rule condition and notify action"); goto end; } @@ -1927,10 +1924,10 @@ static void test_uprobe_event_rule_notification( const char *test_symbol_name) { int i, ret; + enum lttng_error_code ret_code; const int notification_count = 3; enum lttng_notification_channel_status nc_status; enum lttng_event_rule_status event_rule_status; - enum lttng_trigger_status trigger_status; struct lttng_notification_channel *notification_channel = NULL; struct lttng_userspace_probe_location *probe_location = NULL; struct lttng_userspace_probe_location_lookup_method *lookup_method = @@ -1972,7 +1969,7 @@ static void test_uprobe_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting uprobe event rule name: '%s'", trigger_name); - condition = lttng_condition_on_event_create(event_rule); + condition = lttng_condition_event_rule_matches_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the trigger for condition. */ @@ -1982,12 +1979,8 @@ static void test_uprobe_event_rule_notification( goto end; } - trigger_status = lttng_trigger_set_name(trigger, trigger_name); - ok(trigger_status == LTTNG_TRIGGER_STATUS_OK, - "Setting name to trigger '%s'", trigger_name); - - ret = lttng_register_trigger(trigger); - if (ret) { + ret_code = lttng_register_trigger_with_name(trigger, trigger_name); + if (ret_code != LTTNG_OK) { fail("Failed to register trigger with userspace probe event rule condition and notify action"); goto end; } @@ -2034,10 +2027,10 @@ static void test_syscall_event_rule_notification( enum lttng_domain_type domain_type) { int i, ret; + enum lttng_error_code ret_code; const int notification_count = 3; enum lttng_notification_channel_status nc_status; enum lttng_event_rule_status event_rule_status; - enum lttng_trigger_status trigger_status; struct lttng_notification_channel *notification_channel = NULL; struct lttng_condition *condition = NULL; struct lttng_event_rule *event_rule = NULL; @@ -2056,7 +2049,7 @@ static void test_syscall_event_rule_notification( lttng_session_daemon_notification_endpoint); ok(notification_channel, "Notification channel object creation"); - event_rule = lttng_event_rule_syscall_create(); + event_rule = lttng_event_rule_syscall_create(LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY); ok(event_rule, "syscall event rule object creation"); event_rule_status = lttng_event_rule_syscall_set_pattern( @@ -2064,7 +2057,7 @@ static void test_syscall_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting syscall event rule pattern: '%s'", syscall_name); - condition = lttng_condition_on_event_create(event_rule); + condition = lttng_condition_event_rule_matches_create(event_rule); ok(condition, "Condition syscall event rule object creation"); /* Register the trigger for condition. */ @@ -2074,12 +2067,8 @@ static void test_syscall_event_rule_notification( goto end; } - trigger_status = lttng_trigger_set_name(trigger, trigger_name); - ok(trigger_status == LTTNG_TRIGGER_STATUS_OK, - "Setting name to trigger '%s'", trigger_name); - - ret = lttng_register_trigger(trigger); - if (ret) { + ret_code = lttng_register_trigger_with_name(trigger, trigger_name); + if (ret_code != LTTNG_OK) { fail("Failed to register trigger with syscall event rule condition and notify action"); goto end; } @@ -2123,10 +2112,10 @@ static void test_syscall_event_rule_notification_filter( enum lttng_domain_type domain_type) { int i, ret; + enum lttng_error_code ret_code; const int notification_count = 3; enum lttng_notification_channel_status nc_status; enum lttng_event_rule_status event_rule_status; - enum lttng_trigger_status trigger_status; struct lttng_notification_channel *notification_channel = NULL; struct lttng_condition *condition = NULL; struct lttng_event_rule *event_rule = NULL; @@ -2146,7 +2135,7 @@ static void test_syscall_event_rule_notification_filter( lttng_session_daemon_notification_endpoint); ok(notification_channel, "Notification channel object creation"); - event_rule = lttng_event_rule_syscall_create(); + event_rule = lttng_event_rule_syscall_create(LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY); ok(event_rule, "syscall event rule object creation"); event_rule_status = lttng_event_rule_syscall_set_pattern( @@ -2159,7 +2148,7 @@ static void test_syscall_event_rule_notification_filter( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting filter: '%s'", filter_pattern); - condition = lttng_condition_on_event_create(event_rule); + condition = lttng_condition_event_rule_matches_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the triggers for condition */ @@ -2169,12 +2158,8 @@ static void test_syscall_event_rule_notification_filter( goto end; } - trigger_status = lttng_trigger_set_name(trigger, trigger_name); - ok(trigger_status == LTTNG_TRIGGER_STATUS_OK, - "Setting name to trigger '%s'", trigger_name); - - ret = lttng_register_trigger(trigger); - if (ret) { + ret_code = lttng_register_trigger_with_name(trigger, trigger_name); + if (ret_code != LTTNG_OK) { fail("Failed to register trigger with syscall filtering event rule condition and notify action"); goto end; } @@ -2274,7 +2259,7 @@ static int generate_capture_descr(struct lttng_condition *condition) goto end; } - cond_status = lttng_condition_on_event_append_capture_descriptor( + cond_status = lttng_condition_event_rule_matches_append_capture_descriptor( condition, expr); if (cond_status != LTTNG_CONDITION_STATUS_OK) { fail("Failed to append capture descriptor"); @@ -2297,7 +2282,8 @@ static int validator_notification_trigger_capture( { int ret; unsigned int capture_count, i; - enum lttng_evaluation_on_event_status on_event_evaluation_status; + enum lttng_evaluation_event_rule_matches_status + event_rule_matches_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; @@ -2310,12 +2296,13 @@ static int validator_notification_trigger_capture( goto end; } - on_event_evaluation_status = - lttng_evaluation_on_event_get_captured_values( + event_rule_matches_evaluation_status = + lttng_evaluation_event_rule_matches_get_captured_values( evaluation, &captured_fields); - if (on_event_evaluation_status != LTTNG_EVALUATION_ON_EVENT_STATUS_OK) { + if (event_rule_matches_evaluation_status != + LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK) { diag("Failed to get event rule evaluation captured values: status = %d", - (int) on_event_evaluation_status); + (int) event_rule_matches_evaluation_status); ret = 1; goto end; } @@ -2501,7 +2488,7 @@ int main(int argc, const char *argv[]) switch (test_scenario) { case 1: { - plan_tests(44); + plan_tests(41); /* Test cases that need gen-ust-event testapp. */ diag("Test basic notification error paths for %s domain", @@ -2567,7 +2554,7 @@ int main(int argc, const char *argv[]) * Test cases that need a test app with more than one event * type. */ - plan_tests(25); + plan_tests(23); /* * At the moment, the only test case of this scenario is @@ -2639,7 +2626,7 @@ int main(int argc, const char *argv[]) { switch(domain_type) { case LTTNG_DOMAIN_UST: - plan_tests(222); + plan_tests(221); break; case LTTNG_DOMAIN_KERNEL: plan_tests(216);