Tests: Cleanup: add `lttng_{add, remove}_trigger_ok()` bash functions
[lttng-tools.git] / tests / regression / tools / trigger / test_list_triggers_cli
index fb7ce2c49370abe6322cc05c72eefe3ed40cefcf..6a189231a1143970971b9716dbebba662c6139ca 100755 (executable)
@@ -41,12 +41,6 @@ else
        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"
@@ -68,9 +62,9 @@ test_top_level_options ()
        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
@@ -105,49 +99,49 @@ test_on_event_tracepoint ()
        # 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)
@@ -155,7 +149,7 @@ test_on_event_tracepoint ()
              - a
          actions:
            notify
-       - id: T4
+       - id: G
          user id: ${uid}
          condition: event rule hit
            rule: capture-array (type: tracepoint, domain: ust)
@@ -164,7 +158,7 @@ test_on_event_tracepoint ()
              - \$ctx.tourlou[18]
          actions:
            notify
-       - id: T5
+       - id: H
          user id: ${uid}
          condition: event rule hit
            rule: capture-chan-ctx (type: tracepoint, domain: ust)
@@ -172,7 +166,7 @@ test_on_event_tracepoint ()
              - \$ctx.vpid
          actions:
            notify
-       - id: T6
+       - id: I
          user id: ${uid}
          condition: event rule hit
            rule: capture-app-ctx (type: tracepoint, domain: ust)
@@ -211,9 +205,9 @@ test_on_event_probe ()
 
        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
@@ -246,7 +240,7 @@ test_on_event_userspace_probe ()
        # 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
@@ -267,8 +261,8 @@ test_on_event_syscall ()
        # 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
@@ -294,14 +288,14 @@ test_snapshot_action ()
 {
        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
This page took 0.026958 seconds and 4 git commands to generate.