static
struct lttng_condition *parse_condition(const char *condition_name, int *argc,
- const char ***argv, int argc_offset)
+ const char ***argv, int argc_offset, int orig_arg_index,
+ const char *orig_arg)
{
int i;
struct lttng_condition *cond;
}
if (!descr) {
- ERR("Unknown condition name '%s'", condition_name);
+ ERR(WHILE_PARSING_ARG_N_ARG_FMT "Unknown condition name '%s'",
+ orig_arg_index + 1, orig_arg, condition_name);
goto error;
}
static
struct lttng_action *parse_action(const char *action_name, int *argc,
- const char ***argv, int argc_offset)
+ const char ***argv, int argc_offset, int orig_arg_index,
+ const char *orig_arg)
{
int i;
struct lttng_action *action;
}
if (!descr) {
- ERR("Unknown action name: %s", action_name);
+ ERR(WHILE_PARSING_ARG_N_ARG_FMT "Unknown action name: %s",
+ orig_arg_index + 1, orig_arg, action_name);
goto error;
}
}
condition = parse_condition(arg, &my_argc, &my_argv,
- argc - my_argc);
+ argc - my_argc, argc - my_argc - ingested_args,
+ my_argv[-ingested_args]);
if (!condition) {
/*
* An error message was already printed by
case OPT_ACTION:
{
action = parse_action(arg, &my_argc, &my_argv,
- argc - my_argc);
+ argc - my_argc, argc - my_argc - ingested_args,
+ my_argv[-ingested_args]);
if (!action) {
/*
* An error message was already printed by
# shellcheck source=../../../utils/utils.sh
source "$TESTDIR/utils/utils.sh"
-plan_tests 286
+plan_tests 289
FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
"Error: While parsing argument #2 (\`--condition\`): Missing required argument for option \`--condition\`" \
--condition
test_failure "unknown --condition" \
- "Error: Unknown condition name 'zoofest'" \
+ "Error: While parsing argument #2 (\`--condition\`): Unknown condition name 'zoofest'" \
--condition zoofest
+test_failure "unknown --condition=" \
+ "Error: While parsing argument #2 (\`--condition=zoofest\`): Unknown condition name 'zoofest'" \
+ --condition=zoofest
# `--condition event-rule-matches` failures
test_failure "missing args after --condition event-rule-matches" \