From: Jérémie Galarneau Date: Thu, 1 Jul 2021 19:50:47 +0000 (-0400) Subject: Fix: lttng: add-trigger: don't provide a default event rule type X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0b621ec1611e013ae77ff943fc9b8947b3372d9e;p=lttng-tools.git Fix: lttng: add-trigger: don't provide a default event rule type There is no reason for an event rule to have a default type. The --type parameter is required. Signed-off-by: Jérémie Galarneau Change-Id: Ic7f03453fac410c96ca6bb3b3ca0bdfb297a10d1 --- diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index 6eaee74b2..27f6cc8c6 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -832,7 +832,8 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) } if (event_rule_type == LTTNG_EVENT_RULE_TYPE_UNKNOWN) { - event_rule_type = LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT; + ERR("Event rule requires a --type."); + goto error; } /* diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli index 62153a383..49cff975a 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -459,7 +459,7 @@ test_failure "unknown --condition" \ # `--condition event-rule-matches` failures test_failure "missing args after --condition event-rule-matches" \ "Error: Need at least one --action." \ - --condition event-rule-matches + --condition event-rule-matches --type=user test_failure "extra args after --condition event-rule-matches" \ "Error: Unexpected argument 'bozo'" \