X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ftrigger%2Ftest_add_trigger_cli;h=a8d03c4dd66d9f3aabacc1f78f7bba9e3861b4e2;hp=db325a90d61884225eab325f1de7c9a211c500c4;hb=1d4b59f247e2692bf1e9c3c0aac93a47389d20dd;hpb=20a01d1592c8e83d2dfe51cbd192857537ae7d4e diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli index db325a90d..a8d03c4dd 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -23,7 +23,7 @@ TESTDIR="$CURDIR/../../.." # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" -plan_tests 222 +plan_tests 234 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" @@ -46,7 +46,9 @@ function test_success () shift diag "${FULL_LTTNG_BIN} add-trigger $*" + set -x "${FULL_LTTNG_BIN}" add-trigger "$@" > "${tmp_stdout}" 2> "${tmp_stderr}" + set +x ok $? "${test_name}: exit code is 0" diff -u "${tmp_stdout}" <(echo "Trigger registered successfully.") @@ -75,8 +77,8 @@ function test_failure () } # top-level options -test_success "explicit id" \ - --id hohoho \ +test_success "explicit name" \ + --name hohoho \ --condition on-event some-event-id -u \ --action notify @@ -89,15 +91,40 @@ test_success "--condition on-event -a -u" \ --condition on-event -a -u \ --action notify -test_success "--fire-once-after" \ - --condition on-event -u test-fire-once-after \ +test_success "notify action polices" \ + --condition on-event -u test-rate-policy=once-after \ --action notify \ - --fire-once-after=55 - -test_success "--fire-every" \ - --condition on-event -u test-fire-every \ + --rate-policy=every:55 \ --action notify \ - --fire-every=55 + --rate-policy=once-after:55 + +test_success "start session action polices" \ + --condition on-event -u test-rate-policy=once-after \ + --action start-session my_session \ + --rate-policy=every:55 \ + --action start-session my_session \ + --rate-policy=once-after:55 + +test_success "stop session action polices" \ + --condition on-event -u test-rate-policy=once-after \ + --action stop-session my_session \ + --rate-policy=every:55 \ + --action stop-session my_session \ + --rate-policy=once-after:55 + +test_success "snapshot session action polices" \ + --condition on-event -u test-rate-policy=once-after \ + --action snapshot-session my_session \ + --rate-policy=every:55 \ + --action snapshot-session my_session \ + --rate-policy=once-after:55 + +test_success "rotate session action polices" \ + --condition on-event -u test-rate-policy=once-after \ + --action rotate-session my_session \ + --rate-policy=every:55 \ + --action rotate-session my_session \ + --rate-policy=once-after:55 skip $ist_root "non-root user: skipping kprobe tests" 9 || { test_success "--condition on-event probe by symbol" \ @@ -235,30 +262,35 @@ test_failure "two --condition" \ --condition on-event bbb -u \ --action notify -test_failure "missing argument to --id" \ - "Error: While parsing argument #1 (\`--id\`): Missing required argument for option \`--id\`" \ - --id +test_failure "missing argument to --name" \ + "Error: While parsing argument #1 (\`--name\`): Missing required argument for option \`--name\`" \ + --name -for cmd in fire-once-after fire-every; do +for cmd in rate-policy=once-after rate-policy=every; do test_failure "missing argument to --${cmd}" \ - "Error: While parsing argument #1 (\`--${cmd}\`): Missing required argument for option \`--${cmd}\`" \ + "Error: Rate policy format is invalid." \ --condition on-event -u -a --action notify \ --${cmd} test_failure "invalid argument to --${cmd}: non-digit character" \ - "Error: Failed to parse \`123bob\` as an integer." \ + "Error: Failed to parse rate policy value \`123bob\` as an integer." \ --condition on-event -u -a --action notify \ - --${cmd} 123bob + --${cmd}:123bob test_failure "invalid argument to --${cmd}: empty string" \ - "Error: Failed to parse \`\` as an integer." \ + "Error: Failed to parse rate policy value \`\` as an integer." \ --condition on-event -u -a --action notify \ - --${cmd} "" + --${cmd}":" done +test_failure "invalid argument to --rate-policy: unknown policy type" \ + "Error: Rate policy type \`bob\` unknown." \ + --condition on-event -u -a --action notify \ + --rate-policy=bob:123 + # `--condition` failures test_failure "missing args after --condition" \ - "Error: Missing condition name." \ + "Error: While parsing argument #1 (\`--condition\`): Missing required argument for option \`--condition\`" \ --condition test_failure "unknown --condition" \ "Error: Unknown condition name 'zoofest'" \ @@ -348,7 +380,7 @@ test_failure "--condition on-event --capture: missing colon in app-specific cont # `--action` failures test_failure "missing args after --action" \ - "Error: Missing action name." \ + "Error: While parsing argument #1 (\`--action\`): Missing required argument for option \`--action\`" \ --condition on-event -u -a \ --action