Cleanup: tests: name all temporary files to better identify leakage
[lttng-tools.git] / tests / regression / tools / trigger / test_list_triggers_cli
index faf3a030fa51365eeb4beb3428f3a9c4a712cce1..26f2f9f46e4b53d0167f478485df57431bf75508 100755 (executable)
@@ -27,9 +27,9 @@ NUM_TESTS=106
 
 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
 
-tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX)
-tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX)
-tmp_expected_stdout=$(mktemp -t test_list_triggers_cli_expected_stdout.XXXXXX)
+tmp_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_stdout.XXXXXX)
+tmp_stderr=$(mktemp --tmpdir -t test_list_triggers_cli_stderr.XXXXXX)
+tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_expected_stdout.XXXXXX)
 uprobe_elf_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary")
 uprobe_sdt_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-sdt-binary/.libs/userspace-probe-sdt-binary")
 register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers")
@@ -51,21 +51,6 @@ else
 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"
@@ -75,7 +60,7 @@ test_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
@@ -106,7 +91,7 @@ test_event_rule_matches_tracepoint ()
        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
@@ -114,7 +99,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -122,7 +107,7 @@ test_event_rule_matches_tracepoint ()
          errors: none
        - name: C
          owner uid: ${uid}
-         condition: event rule hit
+         condition: event rule matches
            rule: * (type: tracepoint, domain: ust)
          actions:
            notify
@@ -130,7 +115,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -138,7 +123,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -146,7 +131,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -156,7 +141,7 @@ test_event_rule_matches_tracepoint ()
          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]
@@ -167,7 +152,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -177,7 +162,7 @@ test_event_rule_matches_tracepoint ()
          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
@@ -187,7 +172,7 @@ test_event_rule_matches_tracepoint ()
          errors: none
        - name: J
          owner uid: ${uid}
-         condition: event rule hit
+         condition: event rule matches
            rule: lemming (type: tracepoint, domain: ust)
          actions:
            notify
@@ -239,7 +224,7 @@ test_event_rule_matches_probe ()
        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
@@ -247,7 +232,7 @@ test_event_rule_matches_probe ()
          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
@@ -255,7 +240,7 @@ test_event_rule_matches_probe ()
          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
@@ -281,7 +266,7 @@ test_event_rule_matches_userspace_probe_elf ()
        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
@@ -306,7 +291,7 @@ test_event_rule_matches_userspace_probe_sdt ()
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
          owner uid: 0
-         condition: event rule hit
+         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
@@ -332,7 +317,7 @@ test_event_rule_matches_syscall ()
        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
@@ -340,7 +325,7 @@ test_event_rule_matches_syscall ()
          errors: none
        - name: T1
          owner uid: ${uid}
-         condition: event rule hit
+         condition: event rule matches
            rule: open (type: syscall:entry)
          actions:
            notify
@@ -348,7 +333,7 @@ test_event_rule_matches_syscall ()
          errors: none
        - name: T2
          owner uid: ${uid}
-         condition: event rule hit
+         condition: event rule matches
            rule: open (type: syscall:exit)
          actions:
            notify
@@ -356,7 +341,7 @@ test_event_rule_matches_syscall ()
          errors: none
        - name: T3
          owner uid: ${uid}
-         condition: event rule hit
+         condition: event rule matches
            rule: open (type: syscall:entry+exit)
          actions:
            notify
@@ -364,7 +349,7 @@ test_event_rule_matches_syscall ()
          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
@@ -508,7 +493,7 @@ test_snapshot_action ()
        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\`
@@ -516,7 +501,7 @@ test_snapshot_action ()
          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
@@ -524,7 +509,7 @@ test_snapshot_action ()
          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
@@ -532,7 +517,7 @@ test_snapshot_action ()
          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
@@ -540,7 +525,7 @@ test_snapshot_action ()
          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
@@ -548,7 +533,7 @@ test_snapshot_action ()
          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
@@ -556,7 +541,7 @@ test_snapshot_action ()
          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
@@ -564,7 +549,7 @@ test_snapshot_action ()
          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
@@ -572,15 +557,15 @@ test_snapshot_action ()
          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
@@ -610,7 +595,7 @@ test_notify_action ()
        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
@@ -618,10 +603,10 @@ test_notify_action ()
          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
This page took 0.027884 seconds and 4 git commands to generate.