X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ftrigger%2Ftest_list_triggers_cli;h=a040180138bac02f356bcdae687dc1b826250722;hb=910baef8e51541ec587fb6530f3ff9bac9e7cf1c;hp=dcc6344385f15d394f2c4187f5a506bc39756e1e;hpb=8ce7c93a4e83444a093f00aa7ed04c75233cd7a0;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 dcc634438..a04018013 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_expected_stdout_mi=$(mktemp --tmpdir -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")
@@ -69,7 +70,65 @@ test_top_level_options ()
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"
}
@@ -191,7 +250,535 @@ test_event_rule_matches_tracepoint ()
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"
@@ -212,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 'lttng_channel_enable' /proc/kallsyms | cut -f 1 -d ' ')
+ channel_disable_addr=$(grep 'lttng_channel_disable' /proc/kallsyms | cut -f 1 -d ' ')
# We need to find a valid offset.
base_symbol=""
@@ -227,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
@@ -262,7 +850,174 @@ test_event_rule_matches_probe ()
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"
@@ -289,7 +1044,75 @@ test_event_rule_matches_userspace_probe_elf ()
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"
}
@@ -315,7 +1138,75 @@ test_event_rule_matches_userspace_probe_sdt ()
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"
}
@@ -378,7 +1269,256 @@ test_event_rule_matches_syscall ()
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"
@@ -404,7 +1544,54 @@ test_session_consumed_size_condition ()
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"
}
@@ -464,7 +1651,163 @@ test_buffer_usage_conditions ()
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"
@@ -497,7 +1840,85 @@ test_session_rotation_conditions ()
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"
@@ -611,7 +2032,513 @@ test_snapshot_action ()
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"
@@ -651,7 +2578,111 @@ test_notify_action ()
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"
@@ -664,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