lttng {add,list}-triggers: use `name` instead of `id`
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 9 Apr 2021 18:46:42 +0000 (14:46 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 02:18:00 +0000 (22:18 -0400)
The right term is "trigger name", not "trigger id".  Change the option
to add-trigger accordingly, as well as the output of list-trigger.

Change-Id: I5c304aea2c37f983de001cb11c5ba8859f564617
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/add_trigger.c
src/bin/lttng/commands/list_triggers.c
tests/regression/tools/trigger/test_add_trigger_cli
tests/regression/tools/trigger/test_list_triggers_cli
tests/regression/tools/trigger/test_remove_trigger_cli
tests/utils/utils.sh

index fdfbecfaa0afbb8e23d65747fce8d5c61db02c40..af5c420e1fe769a708dcaf8e03da5efb93c53339 100644 (file)
@@ -2026,7 +2026,7 @@ struct argpar_opt_descr add_trigger_options[] = {
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
        { OPT_CONDITION, '\0', "condition", true },
        { OPT_ACTION, '\0', "action", true },
-       { OPT_ID, '\0', "id", true },
+       { OPT_NAME, '\0', "name", true },
        { OPT_USER_ID, '\0', "user-id", true },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
@@ -2052,7 +2052,7 @@ int cmd_add_trigger(int argc, const char **argv)
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
        char *error = NULL;
-       char *id = NULL;
+       char *name = NULL;
        int i;
        char *user_id = NULL;
 
@@ -2152,9 +2152,9 @@ int cmd_add_trigger(int argc, const char **argv)
 
                        break;
                }
-               case OPT_ID:
+               case OPT_NAME:
                {
-                       if (!assign_string(&id, item_opt->arg, "--id")) {
+                       if (!assign_string(&name, item_opt->arg, "--name")) {
                                goto error;
                        }
 
@@ -2212,12 +2212,12 @@ int cmd_add_trigger(int argc, const char **argv)
                goto error;
        }
 
-       if (id) {
+       if (name) {
                enum lttng_trigger_status trigger_status =
-                               lttng_trigger_set_name(trigger, id);
+                               lttng_trigger_set_name(trigger, name);
 
                if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
-                       ERR("Failed to set trigger id.");
+                       ERR("Failed to set trigger name.");
                        goto error;
                }
        }
@@ -2262,7 +2262,7 @@ end:
        lttng_action_destroy(action);
        lttng_trigger_destroy(trigger);
        free(error);
-       free(id);
+       free(name);
        free(user_id);
        return ret;
 }
index 1590bbc79619693843edc9c9c80418c64027b2bf..3b806e7ea2bd98b15ae78595c84849c4794f321d 100644 (file)
@@ -816,7 +816,7 @@ void print_one_trigger(const struct lttng_trigger *trigger)
        trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
        assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-       MSG("- id: %s", name);
+       MSG("- name: %s", name);
        MSG("  user id: %d", trigger_uid);
 
        condition = lttng_trigger_get_const_condition(trigger);
index fd962c04bae76421336e8bc43bee441fbb1111b6..a8d03c4dd66d9f3aabacc1f78f7bba9e3861b4e2 100755 (executable)
@@ -77,8 +77,8 @@ function test_failure ()
 }
 
 # top-level options
-test_success "explicit id" \
-       --id hohoho \
+test_success "explicit name" \
+       --name hohoho \
        --condition on-event some-event-id -u \
        --action notify
 
@@ -262,9 +262,9 @@ test_failure "two --condition" \
        --condition on-event bbb -u \
        --action notify
 
-test_failure "missing argument to --id" \
-       "Error: While parsing argument #1 (\`--id\`): Missing required argument for option \`--id\`" \
-       --id
+test_failure "missing argument to --name" \
+       "Error: While parsing argument #1 (\`--name\`): Missing required argument for option \`--name\`" \
+       --name
 
 for cmd in rate-policy=once-after rate-policy=every; do
        test_failure "missing argument to --${cmd}" \
index 9c85838b399554492b982ba82318301b1b593cb3..42893f5d6c45c8e41c388c31c3db08fb0be9d4ad 100755 (executable)
@@ -73,7 +73,7 @@ test_top_level_options ()
        lttng_add_trigger_ok "hello" --condition on-event -u test-id --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: hello
+       - name: hello
          user id: ${uid}
          condition: event rule hit
            rule: test-id (type: tracepoint, domain: ust)
@@ -104,7 +104,7 @@ test_on_event_tracepoint ()
 
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: A
+       - name: A
          user id: ${uid}
          condition: event rule hit
            rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
@@ -112,7 +112,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: B
+       - name: B
          user id: ${uid}
          condition: event rule hit
            rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
@@ -120,7 +120,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: C
+       - name: C
          user id: ${uid}
          condition: event rule hit
            rule: * (type: tracepoint, domain: ust)
@@ -128,7 +128,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: D
+       - name: D
          user id: ${uid}
          condition: event rule hit
            rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
@@ -136,7 +136,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: E
+       - name: E
          user id: ${uid}
          condition: event rule hit
            rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
@@ -144,7 +144,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: F
+       - name: F
          user id: ${uid}
          condition: event rule hit
            rule: capture-payload-field (type: tracepoint, domain: ust)
@@ -154,7 +154,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: G
+       - name: G
          user id: ${uid}
          condition: event rule hit
            rule: capture-array (type: tracepoint, domain: ust)
@@ -165,7 +165,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: H
+       - name: H
          user id: ${uid}
          condition: event rule hit
            rule: capture-chan-ctx (type: tracepoint, domain: ust)
@@ -175,7 +175,7 @@ test_on_event_tracepoint ()
            notify
              errors: none
          errors: none
-       - id: I
+       - name: I
          user id: ${uid}
          condition: event rule hit
            rule: capture-app-ctx (type: tracepoint, domain: ust)
@@ -228,7 +228,7 @@ test_on_event_probe ()
        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
+       - name: T0
          user id: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: lttng_channel_enable)
@@ -236,7 +236,7 @@ test_on_event_probe ()
            notify
              errors: none
          errors: none
-       - id: T1
+       - name: T1
          user id: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: ${base_symbol}+${offset_hex})
@@ -244,7 +244,7 @@ test_on_event_probe ()
            notify
              errors: none
          errors: none
-       - id: T2
+       - name: T2
          user id: ${uid}
          condition: event rule hit
            rule: my_channel_enable (type: probe, location: 0x${channel_enable_addr})
@@ -270,7 +270,7 @@ test_on_event_userspace_probe_elf ()
        lttng_add_trigger_ok "T0" --condition on-event -k --userspace-probe=${uprobe_elf_binary}:${elf_function_name} ma-probe-elf --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: T0
+       - name: T0
          user id: ${uid}
          condition: event rule hit
            rule: ma-probe-elf (type: userspace probe, location type: ELF, location: ${uprobe_elf_binary}:${elf_function_name})
@@ -319,7 +319,7 @@ test_on_event_syscall ()
        lttng_add_trigger_ok "T1" --condition on-event -k --syscall ptrace --filter 'a > 2' --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: T0
+       - name: T0
          user id: ${uid}
          condition: event rule hit
            rule: open (type: syscall)
@@ -327,7 +327,7 @@ test_on_event_syscall ()
            notify
              errors: none
          errors: none
-       - id: T1
+       - name: T1
          user id: ${uid}
          condition: event rule hit
            rule: ptrace (type: syscall, filter: a > 2)
@@ -360,7 +360,7 @@ test_snapshot_action ()
 
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: T0
+       - name: T0
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -368,7 +368,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`
              errors: none
          errors: none
-       - id: T1
+       - name: T1
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -376,7 +376,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, path: /some/path
              errors: none
          errors: none
-       - id: T2
+       - name: T2
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -384,7 +384,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, path: /some/other/path
              errors: none
          errors: none
-       - id: T3
+       - name: T3
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -392,7 +392,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, url: net://1.2.3.4
              errors: none
          errors: none
-       - id: T4
+       - name: T4
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -400,7 +400,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235
              errors: none
          errors: none
-       - id: T5
+       - name: T5
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -408,7 +408,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112
              errors: none
          errors: none
-       - id: T6
+       - name: T6
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -416,7 +416,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, path: /some/path, max size: 1234
              errors: none
          errors: none
-       - id: T7
+       - name: T7
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -424,7 +424,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, path: /some/path, name: meh
              errors: none
          errors: none
-       - id: T8
+       - name: T8
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -432,7 +432,7 @@ test_snapshot_action ()
            snapshot session \`ze-session\`, rate policy: after every 10 occurrences
              errors: none
          errors: none
-       - id: T9
+       - name: T9
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -456,7 +456,7 @@ test_notify_action ()
 
 
        cat > "${tmp_expected_stdout}" <<- EOF
-       - id: T0
+       - name: T0
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
@@ -464,7 +464,7 @@ test_notify_action ()
            notify, rate policy: once after 5 occurrences
              errors: none
          errors: none
-       - id: T1
+       - name: T1
          user id: ${uid}
          condition: event rule hit
            rule: some-event (type: tracepoint, domain: ust)
index 8a0f90a9e4049fad013132c2db73c72a890b814c..5ec36bccf0519a1670c1f68dc134c1b3bf789d84 100755 (executable)
@@ -51,13 +51,13 @@ function list_triggers ()
 
 function remove_trigger ()
 {
-       local id="$1"
-       local test_name="remove trigger ${id}"
+       local name="$1"
+       local test_name="remove trigger ${name}"
 
-       "${FULL_LTTNG_BIN}" remove-trigger "${id}" > "${tmp_stdout}" 2> "${tmp_stderr}"
+       "${FULL_LTTNG_BIN}" remove-trigger "${name}" > "${tmp_stdout}" 2> "${tmp_stderr}"
        ok $? "${test_name}: exit code is 0"
 
-       diff -u <(echo "Removed trigger \`${id}\`.") "${tmp_stdout}"
+       diff -u <(echo "Removed trigger \`${name}\`.") "${tmp_stdout}"
        ok $? "${test_name}: expected stdout"
 
        diff -u /dev/null "${tmp_stderr}"
@@ -72,7 +72,7 @@ lttng_add_trigger_ok "ABC" --condition on-event aaa -u --filter 'p == 2' --actio
 lttng_add_trigger_ok "DEF" --condition on-event -u -a --action notify
 
 cat > "${tmp_expected_stdout}" <<- EOF
-- id: ABC
+- name: ABC
   user id: ${uid}
   condition: event rule hit
     rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
@@ -80,7 +80,7 @@ cat > "${tmp_expected_stdout}" <<- EOF
     notify
       errors: none
   errors: none
-- id: DEF
+- name: DEF
   user id: ${uid}
   condition: event rule hit
     rule: * (type: tracepoint, domain: ust)
@@ -94,7 +94,7 @@ list_triggers "two triggers left" "${tmp_expected_stdout}"
 remove_trigger "ABC"
 
 cat > "${tmp_expected_stdout}" <<- EOF
-- id: DEF
+- name: DEF
   user id: ${uid}
   condition: event rule hit
     rule: * (type: tracepoint, domain: ust)
index c81cc2d1adb133f873b203116e438eed33af6fd7..4f4cfc951c3b5f4c21f12688b117330a45d2cc24 100644 (file)
@@ -2198,7 +2198,7 @@ function lttng_add_trigger()
        local trigger_name="$2"
        shift 2
 
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-trigger --id "$trigger_name" "$@" 1> /dev/null 2> /dev/null
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-trigger --name "$trigger_name" "$@" 1> /dev/null 2> /dev/null
        ret=$?
        if [[ $expected_to_fail -eq "1" ]]; then
                test "$ret" -ne "0"
This page took 0.034219 seconds and 4 git commands to generate.