NR_ITER=5
NR_USEC_WAIT=5
-function lttng_add_trigger_ust()
-{
- local expected_to_fail="$1"
- local trigger_name="$2"
- shift 2
-
- "$FULL_LTTNG_BIN" add-trigger --id "$trigger_name" "$@" 1> /dev/null 2> /dev/null
- ret=$?
- if [[ $expected_to_fail -eq "1" ]]; then
- test "$ret" -ne "0"
- ok $? "Add trigger $trigger_name failed as expected"
- else
- ok $ret "Add trigger $trigger_name"
- fi
-}
-
-function lttng_remove_trigger_ust()
-{
- local expected_to_fail="$1"
- local trigger_name="$2"
-
- "$FULL_LTTNG_BIN" remove-trigger "$trigger_name" 1> /dev/null 2> /dev/null
- ret=$?
- if [[ $expected_to_fail -eq "1" ]]; then
- test "$ret" -ne "0"
- ok $? "Remove trigger $trigger_name failed as expected"
- else
- ok $ret "Remove trigger $trigger_name"
- fi
-}
-
-function lttng_add_trigger_ust_ok()
-{
- lttng_add_trigger_ust 0 "$@"
-}
-
-function lttng_remove_trigger_ust_ok()
-{
- lttng_remove_trigger_ust 0 "$@"
-}
-
function lttng_session_is_active()
{
local SESSION_NAME="$1"
# Add `start-session` action to an event-rule condition _followed_ by
# a `notify` action.
- lttng_add_trigger_ust_ok \
+ lttng_add_trigger_ok \
$TRIGGER_NAME \
--condition on-event -u "tp:tptest" \
--action start-session $SESSION_NAME \
lttng_session_is_active $SESSION_NAME
# Tearing down.
- lttng_remove_trigger_ust_ok $TRIGGER_NAME
+ lttng_remove_trigger_ok $TRIGGER_NAME
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
# Add `stop-session` action to an event-rule condition _followed_ by
# a `notify` action.
- lttng_add_trigger_ust_ok \
+ lttng_add_trigger_ok \
$TRIGGER_NAME \
--condition on-event -u "tp:tptest" \
--action stop-session $SESSION_NAME \
lttng_session_is_inactive $SESSION_NAME
# Tearing down.
- lttng_remove_trigger_ust_ok $TRIGGER_NAME
+ lttng_remove_trigger_ok $TRIGGER_NAME
destroy_lttng_session_ok $SESSION_NAME
rm -f "$SYNC_AFTER_NOTIF_REGISTER_PATH"
ist_root=0
fi
-function add_trigger ()
-{
- "${FULL_LTTNG_BIN}" add-trigger "$@"
- ok $? "add trigger \`$*\`: exit code is 0"
-}
-
function list_triggers ()
{
local test_name="$1"
start_lttng_sessiond_notap
- add_trigger --id hello --condition on-event -u test-id --action notify
- add_trigger --fire-once-after 123 --condition on-event -u test-fire-once-after --action notify
- add_trigger --fire-every 124 --condition on-event -u test-fire-every --action notify
+ lttng_add_trigger_ok "hello" --condition on-event -u test-id --action notify
+ lttng_add_trigger_ok "T0" --fire-once-after 123 --condition on-event -u test-fire-once-after --action notify
+ lttng_add_trigger_ok "T1" --fire-every 124 --condition on-event -u test-fire-every --action notify
cat > "${tmp_expected_stdout}" <<- EOF
- id: T0
# shellcheck disable=SC2119
start_lttng_sessiond_notap
- add_trigger --condition on-event -u -a --action notify
- add_trigger --id ABC --condition on-event aaa -u --filter 'p == 2' --action notify
- add_trigger --condition on-event 'hello*' -u -x 'hello2,hello3,hello4' --action notify
- add_trigger --id BCD --condition on-event -u gerboise --loglevel INFO --action notify
- add_trigger --condition on-event -u lemming --loglevel-only WARNING --action notify
- add_trigger --condition on-event -u capture-payload-field --capture a --action notify
- add_trigger --condition on-event -u capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
- add_trigger --condition on-event -u capture-chan-ctx --capture '$ctx.vpid' --action notify
- add_trigger --condition on-event -u capture-app-ctx --capture '$app.iga:active_clients' --action notify
+ lttng_add_trigger_ok "C" --condition on-event -u -a --action notify
+ lttng_add_trigger_ok "A" --condition on-event aaa -u --filter 'p == 2' --action notify
+ lttng_add_trigger_ok "D" --condition on-event 'hello*' -u -x 'hello2,hello3,hello4' --action notify
+ lttng_add_trigger_ok "B" --condition on-event -u gerboise --loglevel INFO --action notify
+ lttng_add_trigger_ok "E" --condition on-event -u lemming --loglevel-only WARNING --action notify
+ lttng_add_trigger_ok "F" --condition on-event -u capture-payload-field --capture a --action notify
+ lttng_add_trigger_ok "G" --condition on-event -u capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
+ lttng_add_trigger_ok "H" --condition on-event -u capture-chan-ctx --capture '$ctx.vpid' --action notify
+ lttng_add_trigger_ok "I" --condition on-event -u capture-app-ctx --capture '$app.iga:active_clients' --action notify
cat > "${tmp_expected_stdout}" <<- EOF
- - id: ABC
+ - id: A
user id: ${uid}
condition: event rule hit
rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
actions:
notify
- - id: BCD
+ - id: B
user id: ${uid}
condition: event rule hit
rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
actions:
notify
- - id: T0
+ - id: C
user id: ${uid}
condition: event rule hit
rule: * (type: tracepoint, domain: ust)
actions:
notify
- - id: T1
+ - id: D
user id: ${uid}
condition: event rule hit
rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
actions:
notify
- - id: T2
+ - id: E
user id: ${uid}
condition: event rule hit
rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
actions:
notify
- - id: T3
+ - id: F
user id: ${uid}
condition: event rule hit
rule: capture-payload-field (type: tracepoint, domain: ust)
- a
actions:
notify
- - id: T4
+ - id: G
user id: ${uid}
condition: event rule hit
rule: capture-array (type: tracepoint, domain: ust)
- \$ctx.tourlou[18]
actions:
notify
- - id: T5
+ - id: H
user id: ${uid}
condition: event rule hit
rule: capture-chan-ctx (type: tracepoint, domain: ust)
- \$ctx.vpid
actions:
notify
- - id: T6
+ - id: I
user id: ${uid}
condition: event rule hit
rule: capture-app-ctx (type: tracepoint, domain: ust)
offset_hex="0x$(printf '%x' $offset)"
- add_trigger --condition on-event -k --probe=lttng_channel_enable my_channel_enable --action notify
- add_trigger --condition on-event -k --probe="${base_symbol}+${offset_hex}" my_channel_enable --action notify
- add_trigger --condition on-event -k --probe="0x${channel_enable_addr}" my_channel_enable --action notify
+ lttng_add_trigger_ok "T0" --condition on-event -k --probe=lttng_channel_enable my_channel_enable --action notify
+ lttng_add_trigger_ok "T1" --condition on-event -k --probe="${base_symbol}+${offset_hex}" my_channel_enable --action notify
+ lttng_add_trigger_ok "T2" --condition on-event -k --probe="0x${channel_enable_addr}" my_channel_enable --action notify
cat > "${tmp_expected_stdout}" <<- EOF
- id: T0
# shellcheck disable=SC2119
start_lttng_sessiond_notap
- add_trigger --condition on-event -k --userspace-probe=${uprobe_elf_binary}:test_function ma-probe --action notify
+ lttng_add_trigger_ok "T0" --condition on-event -k --userspace-probe=${uprobe_elf_binary}:test_function ma-probe --action notify
cat > "${tmp_expected_stdout}" <<- EOF
- id: T0
# shellcheck disable=SC2119
start_lttng_sessiond_notap
- add_trigger --condition on-event -k --syscall open --action notify
- add_trigger --condition on-event -k --syscall ptrace --filter 'a > 2' --action notify
+ lttng_add_trigger_ok "T0" --condition on-event -k --syscall open --action notify
+ lttng_add_trigger_ok "T1" --condition on-event -k --syscall ptrace --filter 'a > 2' --action notify
cat > "${tmp_expected_stdout}" <<- EOF
- id: T0
{
start_lttng_sessiond_notap
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --path /some/path
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --url file:///some/other/path
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --url net://1.2.3.4
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1111 --data-url=tcp://1.2.3.4:1112
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --path /some/path --max-size=1234
- add_trigger --condition on-event -u some-event --action snapshot-session ze-session --path /some/path --name=meh
+ lttng_add_trigger_ok "T0" --condition on-event -u some-event --action snapshot-session ze-session
+ lttng_add_trigger_ok "T1" --condition on-event -u some-event --action snapshot-session ze-session --path /some/path
+ lttng_add_trigger_ok "T2" --condition on-event -u some-event --action snapshot-session ze-session --url file:///some/other/path
+ lttng_add_trigger_ok "T3" --condition on-event -u some-event --action snapshot-session ze-session --url net://1.2.3.4
+ lttng_add_trigger_ok "T4" --condition on-event -u some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
+ lttng_add_trigger_ok "T5" --condition on-event -u 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 on-event -u some-event --action snapshot-session ze-session --path /some/path --max-size=1234
+ lttng_add_trigger_ok "T7" --condition on-event -u some-event --action snapshot-session ze-session --path /some/path --name=meh
cat > "${tmp_expected_stdout}" <<- EOF