X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=tests%2Fregression%2Ftools%2Ftrigger%2Ftest_list_triggers_cli;h=6194b8891e54ea93879e4144192e0f6b5b94b908;hb=d5ed3e6f3a8b52d7f2a3e2277873e0f1914ba515;hp=c55cbcc38238a55d0b75422900e83f44bce080ed;hpb=695f70446965aeac8b1118bb08d572630c96114d;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 c55cbcc38..6194b8891 100755
--- a/tests/regression/tools/trigger/test_list_triggers_cli
+++ b/tests/regression/tools/trigger/test_list_triggers_cli
@@ -23,13 +23,14 @@ TESTDIR="$CURDIR/../../.."
# shellcheck source=../../../utils/utils.sh
source "$TESTDIR/utils/utils.sh"
-NUM_TESTS=106
+NUM_TESTS=150
FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
-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)
+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_expected_stdout_mi=$(mktemp -t test_list_triggers_cli_expected_stdout.mi.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")
@@ -62,13 +63,72 @@ test_top_level_options ()
owner uid: ${uid}
condition: event rule matches
rule: test-name (type: user tracepoint)
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "top level options" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI top level options" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "hello"
}
@@ -93,6 +153,7 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: aaa (type: user tracepoint, filter: p == 2)
+ errors: none
actions:
notify
errors: none
@@ -101,6 +162,7 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: gerboise (type: user tracepoint, log level at least INFO)
+ errors: none
actions:
notify
errors: none
@@ -109,6 +171,7 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: * (type: user tracepoint)
+ errors: none
actions:
notify
errors: none
@@ -117,6 +180,7 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: hello* (type: user tracepoint, exclusions: hello2,hello3,hello4)
+ errors: none
actions:
notify
errors: none
@@ -125,6 +189,7 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: lemming (type: user tracepoint, log level is WARNING)
+ errors: none
actions:
notify
errors: none
@@ -135,6 +200,7 @@ test_event_rule_matches_tracepoint ()
rule: capture-payload-field (type: user tracepoint)
captures:
- a
+ errors: none
actions:
notify
errors: none
@@ -146,6 +212,7 @@ test_event_rule_matches_tracepoint ()
captures:
- a[2]
- \$ctx.tourlou[18]
+ errors: none
actions:
notify
errors: none
@@ -156,6 +223,7 @@ test_event_rule_matches_tracepoint ()
rule: capture-chan-ctx (type: user tracepoint)
captures:
- \$ctx.vpid
+ errors: none
actions:
notify
errors: none
@@ -166,6 +234,7 @@ test_event_rule_matches_tracepoint ()
rule: capture-app-ctx (type: user tracepoint)
captures:
- \$app.iga:active_clients
+ errors: none
actions:
notify
errors: none
@@ -174,13 +243,542 @@ test_event_rule_matches_tracepoint ()
owner uid: ${uid}
condition: event rule matches
rule: lemming (type: user tracepoint)
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "event-rule-matches, tracepoint event rule" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI event-rule-matches, tracepoint event rule" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "A"
lttng_remove_trigger_ok "B"
@@ -201,8 +799,8 @@ test_event_rule_matches_probe ()
diag "Listing event-rule-matches kernel probe"
- channel_enable_addr=$(grep ' t lttng_channel_enable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
- channel_disable_addr=$(grep ' t lttng_channel_disable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
+ channel_enable_addr=$(grep '\' /proc/kallsyms | cut -f 1 -d ' ')
+ channel_disable_addr=$(grep '\' /proc/kallsyms | cut -f 1 -d ' ')
# We need to find a valid offset.
base_symbol=""
@@ -216,6 +814,7 @@ test_event_rule_matches_probe ()
fi
offset_hex="0x$(printf '%x' $offset)"
+ channel_enable_addr_decimal=$(printf '%u' 0x"${channel_enable_addr}")
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
@@ -226,6 +825,7 @@ test_event_rule_matches_probe ()
owner uid: ${uid}
condition: event rule matches
rule: my_channel_enable (type: kernel:kprobe, location: lttng_channel_enable)
+ errors: none
actions:
notify
errors: none
@@ -234,6 +834,7 @@ test_event_rule_matches_probe ()
owner uid: ${uid}
condition: event rule matches
rule: my_channel_enable (type: kernel:kprobe, location: ${base_symbol}+${offset_hex})
+ errors: none
actions:
notify
errors: none
@@ -242,13 +843,181 @@ test_event_rule_matches_probe ()
owner uid: ${uid}
condition: event rule matches
rule: my_channel_enable (type: kernel:kprobe, location: 0x${channel_enable_addr})
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "event-rule-matches, probe event rule" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI event-rule-matches, probe event rule" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
lttng_remove_trigger_ok "T1"
@@ -268,13 +1037,82 @@ test_event_rule_matches_userspace_probe_elf ()
owner uid: ${uid}
condition: event rule matches
rule: ma-probe-elf (type: kernel:uprobe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name})
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "event-rule-matches, userspace-probe event rule" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI event-rule-matches, userspace-probe event rule" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
}
@@ -293,13 +1131,82 @@ test_event_rule_matches_userspace_probe_sdt ()
owner uid: 0
condition: event rule matches
rule: ma-probe-sdt (type: kernel:uprobe, location type: SDT, location: ${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name})
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "event-rule-matches, userspace-probe event rule SDT" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI event-rule-matches, userspace-probe event rule SDT" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
}
@@ -319,6 +1226,7 @@ test_event_rule_matches_syscall ()
owner uid: ${uid}
condition: event rule matches
rule: open (type: kernel:syscall:entry+exit)
+ errors: none
actions:
notify
errors: none
@@ -327,6 +1235,7 @@ test_event_rule_matches_syscall ()
owner uid: ${uid}
condition: event rule matches
rule: open (type: kernel:syscall:entry)
+ errors: none
actions:
notify
errors: none
@@ -335,6 +1244,7 @@ test_event_rule_matches_syscall ()
owner uid: ${uid}
condition: event rule matches
rule: open (type: kernel:syscall:exit)
+ errors: none
actions:
notify
errors: none
@@ -343,6 +1253,7 @@ test_event_rule_matches_syscall ()
owner uid: ${uid}
condition: event rule matches
rule: open (type: kernel:syscall:entry+exit)
+ errors: none
actions:
notify
errors: none
@@ -351,13 +1262,263 @@ test_event_rule_matches_syscall ()
owner uid: ${uid}
condition: event rule matches
rule: ptrace (type: kernel:syscall:entry+exit, filter: a > 2)
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
+
list_triggers_matches_ok "event-rule-matches, syscall event rule" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI event-rule-matches, syscall event rule" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
lttng_remove_trigger_ok "T1"
@@ -376,13 +1537,61 @@ test_session_consumed_size_condition ()
condition: session consumed size
session name: the-session-name
threshold: 1234 bytes
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
+
list_triggers_matches_ok "session consumed size condition" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI session consumed size condition" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "trigger-with-session-consumed-size-condition"
}
@@ -399,6 +1608,7 @@ test_buffer_usage_conditions ()
channel name: the-channel-name
domain: ust
threshold (bytes): 1234
+ errors: none
actions:
notify
errors: none
@@ -410,6 +1620,7 @@ test_buffer_usage_conditions ()
channel name: the-channel-name
domain: ust
threshold (ratio): 0.25
+ errors: none
actions:
notify
errors: none
@@ -421,6 +1632,7 @@ test_buffer_usage_conditions ()
channel name: the-channel-name
domain: ust
threshold (bytes): 2345
+ errors: none
actions:
notify
errors: none
@@ -432,13 +1644,170 @@ test_buffer_usage_conditions ()
channel name: the-channel-name
domain: ust
threshold (ratio): 0.40
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "buffer usage condition" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI buffer usage condition" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "trigger-with-buffer-usage-high-bytes-condition"
lttng_remove_trigger_ok "trigger-with-buffer-usage-high-ratio-condition"
@@ -455,6 +1824,7 @@ test_session_rotation_conditions ()
owner uid: ${uid}
condition: session rotation completed
session name: the-session-name
+ errors: none
actions:
notify
errors: none
@@ -463,13 +1833,92 @@ test_session_rotation_conditions ()
owner uid: ${uid}
condition: session rotation ongoing
session name: the-session-name
+ errors: none
actions:
notify
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "session rotation conditions" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI session rotation conditions" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "trigger-with-session-rotation-completed-condition"
lttng_remove_trigger_ok "trigger-with-session-rotation-ongoing-condition"
@@ -495,6 +1944,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`
errors: none
@@ -503,6 +1953,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, path: /some/path
errors: none
@@ -511,6 +1962,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, path: /some/other/path
errors: none
@@ -519,6 +1971,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4
errors: none
@@ -527,6 +1980,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235
errors: none
@@ -535,6 +1989,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112
errors: none
@@ -543,6 +1998,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, path: /some/path, max size: 1234
errors: none
@@ -551,6 +2007,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, path: /some/path, name: meh
errors: none
@@ -559,6 +2016,7 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, rate policy: every 10 occurrences
errors: none
@@ -567,13 +2025,520 @@ test_snapshot_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
snapshot session \`ze-session\`, rate policy: once after 10 occurrences
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+ EOF
+
list_triggers_matches_ok "snapshot action" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI snapshot action" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
lttng_remove_trigger_ok "T1"
@@ -597,6 +2562,7 @@ test_notify_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
notify, rate policy: once after 5 occurrences
errors: none
@@ -605,13 +2571,118 @@ test_notify_action ()
owner uid: ${uid}
condition: event rule matches
rule: some-event (type: user tracepoint)
+ errors: none
actions:
notify, rate policy: every 10 occurrences
errors: none
errors: none
EOF
+ cat > "${tmp_expected_stdout_mi}" <<- EOF
+
+
+ list-trigger
+
+
+
+ T0
+ ${uid}
+
+
+
+
+ some-event
+
+
+
+
+
+
+ discarded tracer messages
+ Count of messages discarded by the tracer due to a communication error with the session daemon
+
+ 0
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+ total execution failures
+ Aggregated count of errors encountered when executing the action
+
+ 0
+
+
+
+
+
+
+
+
+
+ T1
+ ${uid}
+
+
+
+
+ some-event
+
+
+
+
+
+
+ discarded tracer messages
+ Count of messages discarded by the tracer due to a communication error with the session daemon
+
+ 0
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+ total execution failures
+ Aggregated count of errors encountered when executing the action
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ EOF
+
list_triggers_matches_ok "notify action" "${tmp_expected_stdout}"
+ list_triggers_matches_mi_ok "MI notify action" "${tmp_expected_stdout_mi}"
lttng_remove_trigger_ok "T0"
lttng_remove_trigger_ok "T1"
@@ -624,10 +2695,10 @@ start_lttng_sessiond_notap
test_top_level_options
test_event_rule_matches_tracepoint
-skip $ist_root "non-root user: skipping kprobe tests" 9 || test_event_rule_matches_probe
-skip $ist_root "non-root user: skipping uprobe tests" 5 || test_event_rule_matches_userspace_probe_elf
-skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 5 || test_event_rule_matches_userspace_probe_sdt
-skip $ist_root "non-root user: skipping syscall tests" 13 || test_event_rule_matches_syscall
+skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe
+skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf
+skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt
+skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall
test_session_consumed_size_condition
test_buffer_usage_conditions
test_session_rotation_conditions