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"
cat > "${tmp_expected_stdout}" <<- EOF
- name: hello
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: test-name (type: tracepoint, domain: ust)
actions:
notify
test_event_rule_matches_tracepoint ()
{
- diag "Listing on-event 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,hello3,hello4' --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
cat > "${tmp_expected_stdout}" <<- EOF
- name: A
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
actions:
notify
errors: none
- name: B
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
actions:
notify
errors: none
- name: C
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: * (type: tracepoint, domain: ust)
actions:
notify
errors: none
- name: D
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
actions:
notify
errors: none
- name: E
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
actions:
notify
errors: none
- name: F
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: capture-payload-field (type: tracepoint, domain: ust)
captures:
- a
errors: none
- name: G
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: capture-array (type: tracepoint, domain: ust)
captures:
- a[2]
errors: none
- name: H
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: capture-chan-ctx (type: tracepoint, domain: ust)
captures:
- \$ctx.vpid
errors: none
- name: I
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: capture-app-ctx (type: tracepoint, domain: ust)
captures:
- \$app.iga:active_clients
errors: none
- name: J
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: lemming (type: tracepoint, domain: ust)
actions:
notify
local channel_enable_addr
local channel_disable_addr
- diag "Listing on-event kernel 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 ' ')
cat > "${tmp_expected_stdout}" <<- EOF
- name: T0
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: my_channel_enable (type: probe, location: lttng_channel_enable)
actions:
notify
errors: none
- name: T1
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: my_channel_enable (type: probe, location: ${base_symbol}+${offset_hex})
actions:
notify
errors: none
- name: T2
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: my_channel_enable (type: probe, location: 0x${channel_enable_addr})
actions:
notify
{
local elf_function_name="test_function"
- diag "Listing on-event 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
cat > "${tmp_expected_stdout}" <<- EOF
- name: T0
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: ma-probe-elf (type: userspace probe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name})
actions:
notify
local sdt_provider_name="foobar"
local sdt_probe_name="tp1"
- diag "on-event userspace-probe sdt"
+ diag "Listing event-rule-matches userspace-probe sdt"
- lttng_add_trigger_ok "T0" --condition on-event -k --userspace-probe=sdt:${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name} ma-probe-sdt --action notify
+ 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
cat > "${tmp_expected_stdout}" <<- EOF
- - id: T0
- user id: 0
- condition: event rule hit
+ - name: T0
+ owner uid: 0
+ condition: event rule matches
rule: ma-probe-sdt (type: userspace probe, location type: SDT, location: ${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name})
actions:
notify
errors: none
EOF
- list_triggers_matches_ok "on-event, userspace-probe event rule SDT" "${tmp_expected_stdout}"
+ list_triggers_matches_ok "event-rule-matches, userspace-probe event rule SDT" "${tmp_expected_stdout}"
lttng_remove_trigger_ok "T0"
}
test_event_rule_matches_syscall ()
{
- diag "Listing on-event 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 "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
cat > "${tmp_expected_stdout}" <<- EOF
- name: T0
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: open (type: syscall:entry+exit)
actions:
notify
errors: none
- name: T1
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: open (type: syscall:entry)
actions:
notify
errors: none
- name: T2
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: open (type: syscall:exit)
actions:
notify
errors: none
- name: T3
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: open (type: syscall:entry+exit)
actions:
notify
errors: none
- name: T4
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: ptrace (type: syscall:entry+exit, filter: a > 2)
actions:
notify
cat > "${tmp_expected_stdout}" <<- EOF
- name: T0
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`
errors: none
- name: T1
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, path: /some/path
errors: none
- name: T2
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, path: /some/other/path
errors: none
- name: T3
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4
errors: none
- name: T4
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235
errors: none
- name: T5
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112
errors: none
- name: T6
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, path: /some/path, max size: 1234
errors: none
- name: T7
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, path: /some/path, name: meh
errors: none
- name: T8
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
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
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
snapshot session \`ze-session\`, rate policy: once after 10 occurrences
cat > "${tmp_expected_stdout}" <<- EOF
- name: T0
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
notify, rate policy: once after 5 occurrences
errors: none
- name: T1
owner uid: ${uid}
- condition: event rule hit
+ condition: event rule matches
rule: some-event (type: tracepoint, domain: ust)
actions:
- notify, rate policy: after every 10 occurrences
+ notify, rate policy: every 10 occurrences
errors: none
errors: none
EOF