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-Tag: v2.13.1~13 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=5dad5529ff3173863c46a7693f858102d1dc8fb9 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 8fb79d378..c73154b04 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'" \