# shellcheck source=../../../utils/utils.sh
source "$TESTDIR/utils/utils.sh"
-plan_tests 44
+plan_tests 49
FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
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
- user id: ${uid}
- firing policy: once after 123 occurences
- condition: event rule hit
- rule: test-fire-once-after (type: tracepoint, domain: ust)
- actions:
- notify
- - id: T1
- user id: ${uid}
- firing policy: after every 124 occurences
- condition: event rule hit
- rule: test-fire-every (type: tracepoint, domain: ust)
- actions:
- notify
- id: hello
user id: ${uid}
condition: event rule hit
rule: test-id (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
notify
EOF
user id: ${uid}
condition: event rule hit
rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
+ tracer notifications discarded: 0
actions:
notify
- id: B
user id: ${uid}
condition: event rule hit
rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
+ tracer notifications discarded: 0
actions:
notify
- id: C
user id: ${uid}
condition: event rule hit
rule: * (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
notify
- id: D
user id: ${uid}
condition: event rule hit
rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
+ tracer notifications discarded: 0
actions:
notify
- id: E
user id: ${uid}
condition: event rule hit
rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
+ tracer notifications discarded: 0
actions:
notify
- id: F
user id: ${uid}
condition: event rule hit
rule: capture-payload-field (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
captures:
- a
actions:
user id: ${uid}
condition: event rule hit
rule: capture-array (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
captures:
- a[2]
- \$ctx.tourlou[18]
user id: ${uid}
condition: event rule hit
rule: capture-chan-ctx (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
captures:
- \$ctx.vpid
actions:
user id: ${uid}
condition: event rule hit
rule: capture-app-ctx (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
captures:
- \$app.iga:active_clients
actions:
user id: ${uid}
condition: event rule hit
rule: my_channel_enable (type: probe, location: lttng_channel_enable)
+ tracer notifications discarded: 0
actions:
notify
- id: T1
user id: ${uid}
condition: event rule hit
rule: my_channel_enable (type: probe, location: ${base_symbol}+${offset_hex})
+ tracer notifications discarded: 0
actions:
notify
- id: T2
user id: ${uid}
condition: event rule hit
rule: my_channel_enable (type: probe, location: 0x${channel_enable_addr})
+ tracer notifications discarded: 0
actions:
notify
EOF
user id: ${uid}
condition: event rule hit
rule: ma-probe (type: userspace probe, location: ${uprobe_elf_binary}:test_function)
+ tracer notifications discarded: 0
actions:
notify
EOF
user id: ${uid}
condition: event rule hit
rule: open (type: syscall)
+ tracer notifications discarded: 0
actions:
notify
- id: T1
user id: ${uid}
condition: event rule hit
rule: ptrace (type: syscall, filter: a > 2)
+ tracer notifications discarded: 0
actions:
notify
EOF
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
+ lttng_add_trigger_ok "T8" --condition on-event -u some-event --action snapshot-session ze-session --rate-policy=every:10
+ lttng_add_trigger_ok "T9" --condition on-event -u some-event --action snapshot-session ze-session --rate-policy=once-after:10
cat > "${tmp_expected_stdout}" <<- EOF
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`
- id: T1
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, path: /some/path
- id: T2
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, path: /some/other/path
- id: T3
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4
- id: T4
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235
- id: T5
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112
- id: T6
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, path: /some/path, max size: 1234
- id: T7
user id: ${uid}
condition: event rule hit
rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
actions:
snapshot session \`ze-session\`, path: /some/path, name: meh
+ - id: T8
+ user id: ${uid}
+ condition: event rule hit
+ rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
+ actions:
+ snapshot session \`ze-session\`, rate policy: after every 10 occurrences
+ - id: T9
+ user id: ${uid}
+ condition: event rule hit
+ rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
+ actions:
+ snapshot session \`ze-session\`, rate policy: once after 10 occurrences
+ EOF
+
+ list_triggers "snapshot action" "${tmp_expected_stdout}"
+
+ stop_lttng_sessiond_notap
+}
+
+test_notify_action ()
+{
+ start_lttng_sessiond_notap
+
+ lttng_add_trigger_ok "T0" --condition on-event -u some-event --action notify --rate-policy=once-after:5
+ lttng_add_trigger_ok "T1" --condition on-event -u some-event --action notify --rate-policy=every:10
+
+
+ cat > "${tmp_expected_stdout}" <<- EOF
+ - id: T0
+ user id: ${uid}
+ condition: event rule hit
+ rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
+ actions:
+ notify, rate policy: once after 5 occurrences
+ - id: T1
+ user id: ${uid}
+ condition: event rule hit
+ rule: some-event (type: tracepoint, domain: ust)
+ tracer notifications discarded: 0
+ actions:
+ notify, rate policy: after every 10 occurrences
EOF
list_triggers "snapshot action" "${tmp_expected_stdout}"
skip $ist_root "non-root user: skipping uprobe tests" 4 || test_on_event_userspace_probe
skip $ist_root "non-root user: skipping syscall tests" 5 || test_on_event_syscall
test_snapshot_action
+test_notify_action
# Cleanup
rm -f "${tmp_stdout}"