X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ftrigger%2Ftest_list_triggers_cli;h=c55cbcc38238a55d0b75422900e83f44bce080ed;hb=695f70446965aeac8b1118bb08d572630c96114d;hp=faf3a030fa51365eeb4beb3428f3a9c4a712cce1;hpb=040a195fae526f2881eff2dd923f40573afc6aff;p=lttng-tools.git diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli index faf3a030f..c55cbcc38 100755 --- a/tests/regression/tools/trigger/test_list_triggers_cli +++ b/tests/regression/tools/trigger/test_list_triggers_cli @@ -27,9 +27,9 @@ NUM_TESTS=106 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" -tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX) -tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX) -tmp_expected_stdout=$(mktemp -t test_list_triggers_cli_expected_stdout.XXXXXX) +tmp_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_stdout.XXXXXX) +tmp_stderr=$(mktemp --tmpdir -t test_list_triggers_cli_stderr.XXXXXX) +tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_expected_stdout.XXXXXX) uprobe_elf_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary") uprobe_sdt_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-sdt-binary/.libs/userspace-probe-sdt-binary") register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") @@ -51,32 +51,17 @@ else fi -function list_triggers_matches_ok () -{ - local test_name="$1" - local expected_stdout_file="$2" - - "${FULL_LTTNG_BIN}" list-triggers > "${tmp_stdout}" 2> "${tmp_stderr}" - ok $? "${test_name}: exit code is 0" - - diff -u "${expected_stdout_file}" "${tmp_stdout}" - ok $? "${test_name}: expected stdout" - - diff -u /dev/null "${tmp_stderr}" - ok $? "${test_name}: expected stderr" -} - test_top_level_options () { diag "Listing top level options" - lttng_add_trigger_ok "hello" --condition event-rule-matches --domain=user --name=test-name --action notify + lttng_add_trigger_ok "hello" --condition event-rule-matches --type=user --name=test-name --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: hello owner uid: ${uid} - condition: event rule hit - rule: test-name (type: tracepoint, domain: ust) + condition: event rule matches + rule: test-name (type: user tracepoint) actions: notify errors: none @@ -92,62 +77,62 @@ test_event_rule_matches_tracepoint () { diag "Listing event-rule-matches tracepoint" - lttng_add_trigger_ok "C" --condition event-rule-matches --domain=user --action notify - lttng_add_trigger_ok "A" --condition event-rule-matches --name=aaa --domain=user --filter 'p == 2' --action notify - lttng_add_trigger_ok "D" --condition event-rule-matches --name='hello*' --domain=user -x hello2 --exclude-name hello3 -x hello4 --action notify - lttng_add_trigger_ok "B" --condition event-rule-matches --domain=user --name=gerboise --log-level INFO.. --action notify - lttng_add_trigger_ok "E" --condition event-rule-matches --domain=user --name=lemming --log-level WARNING --action notify - lttng_add_trigger_ok "J" --condition event-rule-matches --domain=user --name=lemming --log-level .. --action notify - lttng_add_trigger_ok "F" --condition event-rule-matches --domain=user --name=capture-payload-field --capture a --action notify - lttng_add_trigger_ok "G" --condition event-rule-matches --domain=user --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify - lttng_add_trigger_ok "H" --condition event-rule-matches --domain=user --name=capture-chan-ctx --capture '$ctx.vpid' --action notify - lttng_add_trigger_ok "I" --condition event-rule-matches --domain=user --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify + lttng_add_trigger_ok "C" --condition event-rule-matches --type=user --action notify + lttng_add_trigger_ok "A" --condition event-rule-matches --name=aaa --type=user --filter 'p == 2' --action notify + lttng_add_trigger_ok "D" --condition event-rule-matches --name='hello*' --type=user -x hello2 --exclude-name hello3 -x hello4 --action notify + lttng_add_trigger_ok "B" --condition event-rule-matches --type=user --name=gerboise --log-level INFO.. --action notify + lttng_add_trigger_ok "E" --condition event-rule-matches --type=user --name=lemming --log-level WARNING --action notify + lttng_add_trigger_ok "J" --condition event-rule-matches --type=user --name=lemming --log-level .. --action notify + lttng_add_trigger_ok "F" --condition event-rule-matches --type=user --name=capture-payload-field --capture a --action notify + lttng_add_trigger_ok "G" --condition event-rule-matches --type=user --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify + lttng_add_trigger_ok "H" --condition event-rule-matches --type=user --name=capture-chan-ctx --capture '$ctx.vpid' --action notify + lttng_add_trigger_ok "I" --condition event-rule-matches --type=user --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: A owner uid: ${uid} - condition: event rule hit - rule: aaa (type: tracepoint, domain: ust, filter: p == 2) + condition: event rule matches + rule: aaa (type: user tracepoint, filter: p == 2) actions: notify errors: none errors: none - name: B owner uid: ${uid} - condition: event rule hit - rule: gerboise (type: tracepoint, domain: ust, log level at least INFO) + condition: event rule matches + rule: gerboise (type: user tracepoint, log level at least INFO) actions: notify errors: none errors: none - name: C owner uid: ${uid} - condition: event rule hit - rule: * (type: tracepoint, domain: ust) + condition: event rule matches + rule: * (type: user tracepoint) actions: notify errors: none errors: none - name: D owner uid: ${uid} - condition: event rule hit - rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4) + condition: event rule matches + rule: hello* (type: user tracepoint, exclusions: hello2,hello3,hello4) actions: notify errors: none errors: none - name: E owner uid: ${uid} - condition: event rule hit - rule: lemming (type: tracepoint, domain: ust, log level is WARNING) + condition: event rule matches + rule: lemming (type: user tracepoint, log level is WARNING) actions: notify errors: none errors: none - name: F owner uid: ${uid} - condition: event rule hit - rule: capture-payload-field (type: tracepoint, domain: ust) + condition: event rule matches + rule: capture-payload-field (type: user tracepoint) captures: - a actions: @@ -156,8 +141,8 @@ test_event_rule_matches_tracepoint () errors: none - name: G owner uid: ${uid} - condition: event rule hit - rule: capture-array (type: tracepoint, domain: ust) + condition: event rule matches + rule: capture-array (type: user tracepoint) captures: - a[2] - \$ctx.tourlou[18] @@ -167,8 +152,8 @@ test_event_rule_matches_tracepoint () errors: none - name: H owner uid: ${uid} - condition: event rule hit - rule: capture-chan-ctx (type: tracepoint, domain: ust) + condition: event rule matches + rule: capture-chan-ctx (type: user tracepoint) captures: - \$ctx.vpid actions: @@ -177,8 +162,8 @@ test_event_rule_matches_tracepoint () errors: none - name: I owner uid: ${uid} - condition: event rule hit - rule: capture-app-ctx (type: tracepoint, domain: ust) + condition: event rule matches + rule: capture-app-ctx (type: user tracepoint) captures: - \$app.iga:active_clients actions: @@ -187,8 +172,8 @@ test_event_rule_matches_tracepoint () errors: none - name: J owner uid: ${uid} - condition: event rule hit - rule: lemming (type: tracepoint, domain: ust) + condition: event rule matches + rule: lemming (type: user tracepoint) actions: notify errors: none @@ -232,31 +217,31 @@ test_event_rule_matches_probe () offset_hex="0x$(printf '%x' $offset)" - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=kprobe --location=lttng_channel_enable --event-name=my_channel_enable --action notify - lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --type=kprobe --location="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify - lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=kernel --type=kprobe --location="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kprobe --location=lttng_channel_enable --event-name=my_channel_enable --action notify + lttng_add_trigger_ok "T1" --condition event-rule-matches --type=kprobe --location="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify + lttng_add_trigger_ok "T2" --condition event-rule-matches --type=kprobe --location="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: ${uid} - condition: event rule hit - rule: my_channel_enable (type: probe, location: lttng_channel_enable) + condition: event rule matches + rule: my_channel_enable (type: kernel:kprobe, location: lttng_channel_enable) actions: notify errors: none errors: none - name: T1 owner uid: ${uid} - condition: event rule hit - rule: my_channel_enable (type: probe, location: ${base_symbol}+${offset_hex}) + condition: event rule matches + rule: my_channel_enable (type: kernel:kprobe, location: ${base_symbol}+${offset_hex}) actions: notify errors: none errors: none - name: T2 owner uid: ${uid} - condition: event rule hit - rule: my_channel_enable (type: probe, location: 0x${channel_enable_addr}) + condition: event rule matches + rule: my_channel_enable (type: kernel:kprobe, location: 0x${channel_enable_addr}) actions: notify errors: none @@ -276,13 +261,13 @@ test_event_rule_matches_userspace_probe_elf () diag "Listing event-rule-matches userspace-probe elf" - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: ${uid} - condition: event rule hit - rule: ma-probe-elf (type: userspace probe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name}) + condition: event rule matches + rule: ma-probe-elf (type: kernel:uprobe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name}) actions: notify errors: none @@ -301,13 +286,13 @@ test_event_rule_matches_userspace_probe_sdt () diag "Listing event-rule-matches userspace-probe sdt" - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=uprobe --location=sdt:${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name} --event-name=ma-probe-sdt --action notify + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kernel:uprobe --location=sdt:${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name} --event-name=ma-probe-sdt --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: 0 - condition: event rule hit - rule: ma-probe-sdt (type: userspace probe, location type: SDT, location: ${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name}) + condition: event rule matches + rule: ma-probe-sdt (type: kernel:uprobe, location type: SDT, location: ${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name}) actions: notify errors: none @@ -323,49 +308,49 @@ test_event_rule_matches_syscall () { diag "Listing event-rule-matches syscall" - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=syscall --name=open --action notify - lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --type=syscall:entry --name=open --action notify - lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=kernel --type=syscall:exit --name=open --action notify - lttng_add_trigger_ok "T3" --condition event-rule-matches --domain=kernel --type=syscall:entry+exit --name=open --action notify - lttng_add_trigger_ok "T4" --condition event-rule-matches --domain=kernel --type=syscall --name=ptrace --filter 'a > 2' --action notify + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=syscall --name=open --action notify + lttng_add_trigger_ok "T1" --condition event-rule-matches --type=syscall:entry --name=open --action notify + lttng_add_trigger_ok "T2" --condition event-rule-matches --type=syscall:exit --name=open --action notify + lttng_add_trigger_ok "T3" --condition event-rule-matches --type=syscall:entry+exit --name=open --action notify + lttng_add_trigger_ok "T4" --condition event-rule-matches --type=syscall --name=ptrace --filter 'a > 2' --action notify cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: ${uid} - condition: event rule hit - rule: open (type: syscall:entry+exit) + condition: event rule matches + rule: open (type: kernel:syscall:entry+exit) actions: notify errors: none errors: none - name: T1 owner uid: ${uid} - condition: event rule hit - rule: open (type: syscall:entry) + condition: event rule matches + rule: open (type: kernel:syscall:entry) actions: notify errors: none errors: none - name: T2 owner uid: ${uid} - condition: event rule hit - rule: open (type: syscall:exit) + condition: event rule matches + rule: open (type: kernel:syscall:exit) actions: notify errors: none errors: none - name: T3 owner uid: ${uid} - condition: event rule hit - rule: open (type: syscall:entry+exit) + condition: event rule matches + rule: open (type: kernel:syscall:entry+exit) actions: notify errors: none errors: none - name: T4 owner uid: ${uid} - condition: event rule hit - rule: ptrace (type: syscall:entry+exit, filter: a > 2) + condition: event rule matches + rule: ptrace (type: kernel:syscall:entry+exit, filter: a > 2) actions: notify errors: none @@ -494,94 +479,94 @@ test_snapshot_action () { diag "Listing snapshot actions" - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session - lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path - lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url file:///some/other/path - lttng_add_trigger_ok "T3" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4 - lttng_add_trigger_ok "T4" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235 - lttng_add_trigger_ok "T5" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1111 --data-url=tcp://1.2.3.4:1112 - lttng_add_trigger_ok "T6" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234 - lttng_add_trigger_ok "T7" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --name=meh - lttng_add_trigger_ok "T8" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=every:10 - lttng_add_trigger_ok "T9" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10 + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session + lttng_add_trigger_ok "T1" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path + lttng_add_trigger_ok "T2" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url file:///some/other/path + lttng_add_trigger_ok "T3" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4 + lttng_add_trigger_ok "T4" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235 + lttng_add_trigger_ok "T5" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1111 --data-url=tcp://1.2.3.4:1112 + lttng_add_trigger_ok "T6" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234 + lttng_add_trigger_ok "T7" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path --name=meh + lttng_add_trigger_ok "T8" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --rate-policy=every:10 + lttng_add_trigger_ok "T9" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10 cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\` errors: none errors: none - name: T1 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, path: /some/path errors: none errors: none - name: T2 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, path: /some/other/path errors: none errors: none - name: T3 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, url: net://1.2.3.4 errors: none errors: none - name: T4 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235 errors: none errors: none - name: T5 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112 errors: none errors: none - name: T6 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, path: /some/path, max size: 1234 errors: none errors: none - name: T7 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, path: /some/path, name: meh errors: none errors: none - name: T8 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: - snapshot session \`ze-session\`, rate policy: after every 10 occurrences + snapshot session \`ze-session\`, rate policy: every 10 occurrences errors: none errors: none - name: T9 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: snapshot session \`ze-session\`, rate policy: once after 10 occurrences errors: none @@ -604,24 +589,24 @@ test_snapshot_action () test_notify_action () { - lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=once-after:5 - lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=every:10 + lttng_add_trigger_ok "T0" --condition event-rule-matches --type=user --name=some-event --action notify --rate-policy=once-after:5 + lttng_add_trigger_ok "T1" --condition event-rule-matches --type=user --name=some-event --action notify --rate-policy=every:10 cat > "${tmp_expected_stdout}" <<- EOF - name: T0 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: notify, rate policy: once after 5 occurrences errors: none errors: none - name: T1 owner uid: ${uid} - condition: event rule hit - rule: some-event (type: tracepoint, domain: ust) + condition: event rule matches + rule: some-event (type: user tracepoint) actions: - notify, rate policy: after every 10 occurrences + notify, rate policy: every 10 occurrences errors: none errors: none EOF