Rename firing policy to rate policy
[lttng-tools.git] / tests / regression / tools / trigger / test_list_triggers_cli
index 6a189231a1143970971b9716dbebba662c6139ca..fa1af958d7d98346ea78bb723e4a7b2106507745 100755 (executable)
@@ -23,7 +23,7 @@ TESTDIR="$CURDIR/../../.."
 # 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}"
 
@@ -63,28 +63,13 @@ test_top_level_options ()
 
 
        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
@@ -115,36 +100,42 @@ test_on_event_tracepoint ()
          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:
@@ -153,6 +144,7 @@ test_on_event_tracepoint ()
          user id: ${uid}
          condition: event rule hit
            rule: capture-array (type: tracepoint, domain: ust)
+           tracer notifications discarded: 0
            captures:
              - a[2]
              - \$ctx.tourlou[18]
@@ -162,6 +154,7 @@ test_on_event_tracepoint ()
          user id: ${uid}
          condition: event rule hit
            rule: capture-chan-ctx (type: tracepoint, domain: ust)
+           tracer notifications discarded: 0
            captures:
              - \$ctx.vpid
          actions:
@@ -170,6 +163,7 @@ test_on_event_tracepoint ()
          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:
@@ -214,18 +208,21 @@ test_on_event_probe ()
          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
@@ -247,6 +244,7 @@ test_on_event_userspace_probe ()
          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
@@ -269,12 +267,14 @@ test_on_event_syscall ()
          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
@@ -296,6 +296,8 @@ test_snapshot_action ()
        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 --fire-every 10
+       lttng_add_trigger_ok "T9" --condition on-event -u some-event --action snapshot-session ze-session --fire-once-after 10
 
 
        cat > "${tmp_expected_stdout}" <<- EOF
@@ -303,50 +305,102 @@ test_snapshot_action ()
          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 --fire-once-after 5
+       lttng_add_trigger_ok "T1" --condition on-event -u some-event --action notify --fire-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}"
@@ -360,6 +414,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 6 || test_on_event_probe
 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}"
This page took 0.025998 seconds and 4 git commands to generate.