X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ftrigger%2Ftest_add_trigger_cli;h=eeef3e250b86dc62c362da05fa4f7a9cd27232f5;hb=3a1744008331a0604479d3d7461f77056fad3a64;hp=62153a383a3e613b488eab7e5b89d6c06bda4caf;hpb=f674361c665441a78fc1db5794a4f28965ff9d26;p=lttng-tools.git diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli index 62153a383..eeef3e250 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -23,23 +23,17 @@ TESTDIR="$CURDIR/../../.." # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" -plan_tests 286 +plan_tests 295 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" # shellcheck disable=SC2119 start_lttng_sessiond_notap -tmp_stdout=$(mktemp --tmpdir -t test_parse_cli_trigger_stdout.XXXXXX) -tmp_stderr=$(mktemp --tmpdir -t test_parse_cli_trigger_stderr.XXXXXX) +tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX) +tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX) uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" -if [ "$(id -u)" == "0" ]; then - ist_root=1 -else - ist_root=0 -fi - function test_success () { local test_name="$1" @@ -47,10 +41,8 @@ function test_success () shift 2 diag "${FULL_LTTNG_BIN} add-trigger $*" - set -x "${FULL_LTTNG_BIN}" add-trigger "$@" > "${tmp_stdout}" 2> "${tmp_stderr}" ok $? "${test_name}: exit code is 0" - set +x diff -u "${tmp_stdout}" <(echo "Added trigger \`$trigger_name\`.") ok $? "${test_name}: expected stdout" @@ -86,8 +78,8 @@ function test_mi () # the one used by the list command. Here we simply validate that a # simple trigger is correctly generated. - tmp_stdout_raw=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_stdout.XXXXXX") - tmp_expected_stdout=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_expected_stdout.XXXXXX") + tmp_stdout_raw=$(mktemp -t "tmp.${FUNCNAME[0]}_stdout.XXXXXX") + tmp_expected_stdout=$(mktemp -t "tmp.${FUNCNAME[0]}_expected_stdout.XXXXXX") diag "${FULL_LTTNG_BIN} --mi=xml add-trigger" @@ -225,7 +217,7 @@ test_success "--exclude-name two" "trigger5" \ --condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \ --action notify -skip $ist_root "non-root user: skipping kprobe tests" 18 || { +check_skip_kernel_test 18 "Skipping kprobe tests." || { i=0 for type in kprobe kernel:kprobe; do @@ -264,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || { done } -skip $ist_root "non-root user: skipping uprobe tests" 6 || { +check_skip_kernel_test 6 "Skipping uprobe tests." || { test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \ --name="uprobe-trigger-0" \ --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \ @@ -276,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || { --action notify } -skip $ist_root "non-root user: skipping syscall tests" 30 || { +check_skip_kernel_test 30 "Skipping syscall tests." || { test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \ --name="syscall-trigger-0" \ --condition event-rule-matches --type=syscall --name=open \ @@ -409,7 +401,7 @@ test_success "--action snapshot-session with ctrl/data URIs" "notify-15"\ test_failure "no args" "Error: Missing --condition." test_failure "unknown option" \ - "Error: Unknown option \`--hello\`" \ + "Error: While parsing argument #2 (\`--hello\`): Unknown option \`--hello\`" \ --hello test_failure "missing --action" \ @@ -423,7 +415,7 @@ test_failure "two --condition" \ --action notify test_failure "missing argument to --name" \ - "Error: While parsing argument #1 (\`--name\`): Missing required argument for option \`--name\`" \ + "Error: While parsing argument #2 (\`--name\`): Missing required argument for option \`--name\`" \ --name for cmd in rate-policy=once-after rate-policy=every; do @@ -450,16 +442,25 @@ test_failure "invalid argument to --rate-policy: unknown policy type" \ # `--condition` failures test_failure "missing args after --condition" \ - "Error: While parsing argument #1 (\`--condition\`): Missing required argument for option \`--condition\`" \ + "Error: While parsing argument #2 (\`--condition\`): Missing required argument for option \`--condition\` +Error: Valid condition names are: +Error: event-rule-matches" \ --condition test_failure "unknown --condition" \ - "Error: Unknown condition name 'zoofest'" \ + "Error: While parsing argument #2 (\`--condition\`): Unknown condition name 'zoofest' +Error: Valid condition names are: +Error: event-rule-matches" \ --condition zoofest +test_failure "unknown --condition=" \ + "Error: While parsing argument #2 (\`--condition=zoofest\`): Unknown condition name 'zoofest' +Error: Valid condition names are: +Error: event-rule-matches" \ + --condition=zoofest # `--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'" \ @@ -497,12 +498,12 @@ test_failure "--condition event-rule-matches: --type=syscall:nope" \ --name=open test_failure "--exclude-name with non-glob name" \ - "Error: Event jean: Exclusions can only be used with a globbing pattern" \ + "Error: Event name pattern must contain wildcard characters to use exclusions" \ --condition event-rule-matches --type=user --name='jean' --exclude-name jean-chretien \ --action notify test_failure "--condition event-rule-matches --capture: missing argument (end of arg list)" \ - 'Error: While parsing argument #2 (`--capture`): Missing required argument for option `--capture`' \ + 'Error: While parsing argument #7 (`--capture`): Missing required argument for option `--capture`' \ --action notify \ --condition event-rule-matches --type=user --capture @@ -548,10 +549,26 @@ test_failure "--condition event-rule-matches --capture: missing colon in app-spe # `--action` failures test_failure "missing args after --action" \ - "Error: While parsing argument #1 (\`--action\`): Missing required argument for option \`--action\`" \ + "Error: While parsing argument #5 (\`--action\`): Missing required argument for option \`--action\` +Error: Valid action names are: +Error: notify" \ --condition event-rule-matches --type=user \ --action +test_failure "unknown --action" \ + "Error: While parsing argument #5 (\`--action\`): Unknown action name 'zoofest' +Error: Valid action names are: +Error: notify" \ + --condition event-rule-matches --type=user \ + --action zoofest + +test_failure "unknown --action=" \ + "Error: While parsing argument #5 (\`--action=zoofest\`): Unknown action name 'zoofest' +Error: Valid action names are: +Error: notify" \ + --condition event-rule-matches --type=user \ + --action=zoofest + # `--action notify` failures test_failure "extra arg after --action notify" \ "Error: Unexpected argument \`bob\`." \