lttng add-trigger: replace domain options with single --domain
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 13 Apr 2021 14:32:21 +0000 (10:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 05:04:04 +0000 (01:04 -0400)
Implement the proposal to replace the --userspace, --kernel, --log4j,
--jul and --python options, used to select a domain, with a single
--domain option that takes an argument.

Change-Id: I9c5ff77523bb974bc1facb6732f3122c2e30395e
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
tests/regression/tools/notification/test_notification_notifier_discarded_count
tests/regression/tools/trigger/rate-policy/test_ust_rate_policy
tests/regression/tools/trigger/start-stop/test_start_stop
tests/regression/tools/trigger/test_add_trigger_cli
tests/regression/tools/trigger/test_list_triggers_cli
tests/regression/tools/trigger/test_remove_trigger_cli

index a885aea61c88acdbe5086c20838e1f6b9a80c9c5..b976ffce92432eb269455aec266d13e67b246513 100644 (file)
@@ -50,11 +50,7 @@ enum {
        OPT_LOGLEVEL,
        OPT_LOGLEVEL_ONLY,
 
-       OPT_USERSPACE,
-       OPT_KERNEL,
-       OPT_LOG4J,
-       OPT_JUL,
-       OPT_PYTHON,
+       OPT_DOMAIN,
 
        OPT_FUNCTION,
        OPT_PROBE,
@@ -79,12 +75,7 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
        { OPT_LOGLEVEL_ONLY, '\0', "loglevel-only", true },
        { OPT_EVENT_NAME, 'E', "event-name", true },
 
-       /* Domains */
-       { OPT_USERSPACE, 'u', "userspace", false },
-       { OPT_KERNEL, 'k', "kernel", false },
-       { OPT_LOG4J, 'l', "log4j", false },
-       { OPT_JUL, 'j', "jul", false },
-       { OPT_PYTHON, 'p', "python", false },
+       { OPT_DOMAIN, 'd', "domain", true },
 
        /* Event rule types */
        { OPT_FUNCTION, '\0', "function", true },
@@ -100,19 +91,37 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
 };
 
 static
-bool assign_domain_type(enum lttng_domain_type *dest,
-               enum lttng_domain_type src)
+bool assign_domain_type(enum lttng_domain_type *dest, const char *arg)
 {
        bool ret;
 
-       if (*dest == LTTNG_DOMAIN_NONE || *dest == src) {
-               *dest = src;
-               ret = true;
+       if (*dest != LTTNG_DOMAIN_NONE) {
+               ERR("More than one `--domain` was specified.");
+               goto error;
+       }
+
+       if (strcmp(arg, "kernel") == 0) {
+               *dest = LTTNG_DOMAIN_KERNEL;
+       } else if (strcmp(arg, "user") == 0 || strcmp(arg, "userspace") == 0) {
+               *dest = LTTNG_DOMAIN_UST;
+       } else if (strcmp(arg, "jul") == 0) {
+               *dest = LTTNG_DOMAIN_JUL;
+       } else if (strcmp(arg, "log4j") == 0) {
+               *dest = LTTNG_DOMAIN_LOG4J;
+       } else if (strcmp(arg, "python") == 0) {
+               *dest = LTTNG_DOMAIN_PYTHON;
        } else {
-               ERR("Multiple domains specified.");
-               ret = false;
+               ERR("Invalid `--domain` value: %s", arg);
+               goto error;
        }
 
+       ret = true;
+       goto end;
+
+error:
+       ret = false;
+
+end:
        return ret;
 }
 
@@ -590,32 +599,8 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 
                        switch (item_opt->descr->id) {
                        /* Domains. */
-                       case OPT_USERSPACE:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_UST)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_KERNEL:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_KERNEL)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_LOG4J:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_LOG4J)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_JUL:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_JUL)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_PYTHON:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_PYTHON)) {
+                       case OPT_DOMAIN:
+                               if (!assign_domain_type(&domain_type, item_opt->arg)) {
                                        goto error;
                                }
 
@@ -825,7 +810,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 
        /* Need to specify a domain. */
        if (domain_type == LTTNG_DOMAIN_NONE) {
-               ERR("Please specify a domain (--kernel/--userspace/--jul/--log4j/--python).");
+               ERR("Please specify a domain (--domain=(kernel,user,jul,log4j,python)).");
                goto error;
        }
 
index dc75f8543f4ec4683cdf081b0a23ce24b9e33cb6..5df86d60504368184f872a81687bad4cc205db87 100755 (executable)
@@ -78,7 +78,7 @@ function test_kernel_notifier_discarded_count
        done
 
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --domain=kernel --name=lttng_test_filter_event \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -107,7 +107,7 @@ function test_kernel_notifier_discarded_count
 
        # Enable another notifier and list it to confirm the counter was cleared.
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --domain=kernel --name=lttng_test_filter_event \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -129,13 +129,13 @@ function test_kernel_notifier_discarded_count_max_bucket
        diag "Kernel event notifer error counter bucket limit"
        for i in $(seq 3); do
                lttng_add_trigger_ok "$i" \
-                       --condition event-rule-matches --kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
        for i in $(seq 4 5); do
                lttng_add_trigger_fail "$i" \
-                       --condition event-rule-matches --kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
@@ -180,7 +180,7 @@ function test_ust_notifier_discarded_count
        done
 
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --userspace --name=tp:tptest \
+               --condition event-rule-matches --domain=user --name=tp:tptest \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -206,7 +206,7 @@ function test_ust_notifier_discarded_count
 
        # Enable another notifier and list it to confirm the counter was cleared.
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --userspace --name=tp:tptest \
+               --condition event-rule-matches --domain=user --name=tp:tptest \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -226,13 +226,13 @@ function test_ust_notifier_discarded_count_max_bucket
        diag "UST event notifer error counter bucket limit"
        for i in $(seq 3); do
                lttng_add_trigger_ok "$i" \
-                       --condition event-rule-matches --userspace --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
        for i in $(seq 4 5); do
                lttng_add_trigger_fail "$i" \
-                       --condition event-rule-matches --userspace --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
index 8a392a0f99f2fed5c160db83a69640fee28a791d..ef4626c250286e783790beaf8d8c5f27cfb8f838 100755 (executable)
@@ -36,7 +36,7 @@ function test_rate_policy_every_n()
        # time the condition is met.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches -u --name="tp:tptest" \
+               --condition event-rule-matches --domain=user --name="tp:tptest" \
                --action notify \
                --rate-policy=every:5
 
@@ -46,7 +46,7 @@ function test_rate_policy_every_n()
        # the notification subsystem. 
        lttng_add_trigger_ok \
                $END_TRIGGER_NAME \
-               --condition event-rule-matches -u --name="tp:end" \
+               --condition event-rule-matches --domain=user --name="tp:end" \
                --action notify
 
        for i in $(seq 1 4); do
@@ -122,7 +122,7 @@ function test_rate_policy_once_after_n()
        # time the condition is met.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches -u --name="tp:tptest" \
+               --condition event-rule-matches --domain=user --name="tp:tptest" \
                --action notify \
                --rate-policy=once-after:5
 
@@ -132,7 +132,7 @@ function test_rate_policy_once_after_n()
        # the notification subsystem. 
        lttng_add_trigger_ok \
                $END_TRIGGER_NAME \
-               --condition event-rule-matches -u --name="tp:end" \
+               --condition event-rule-matches --domain=user --name="tp:end" \
                --action notify
 
        ## Phase 1
index b5937797d0bea1654eaa7587a79917f06d6052e9..989079c4dc54c334bc42aacc4b1889c16f57e656 100755 (executable)
@@ -57,7 +57,7 @@ function test_start_session_action()
        # a `notify` action.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches -u --name=tp:tptest \
+               --condition event-rule-matches --domain=user --name=tp:tptest \
                --action start-session $SESSION_NAME \
                --action notify
 
@@ -111,7 +111,7 @@ function test_stop_session_action()
        # a `notify` action.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches -u --name=tp:tptest \
+               --condition event-rule-matches --domain=user --name=tp:tptest \
                --action stop-session $SESSION_NAME \
                --action notify
 
index b712bdd3c1c4ecd5971215d9a2c33e679b62bc80..7b56fcfa603263ff1f6746572094fc81d7b65112 100755 (executable)
@@ -23,7 +23,7 @@ TESTDIR="$CURDIR/../../.."
 # shellcheck source=../../../utils/utils.sh
 source "$TESTDIR/utils/utils.sh"
 
-plan_tests 222
+plan_tests 228
 
 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
 
@@ -79,48 +79,48 @@ function test_failure ()
 # top-level options
 test_success "explicit name" \
        --name hohoho \
-       --condition event-rule-matches --name=some-event-id -u \
+       --condition event-rule-matches --name=some-event-id --domain=user \
        --action notify
 
 # `--condition event-rule-matches` successes
-test_success "--condition event-rule-matches some-event -u" \
-       --condition event-rule-matches --name=some-event -u \
+test_success "--condition event-rule-matches some-event --domain=user" \
+       --condition event-rule-matches --name=some-event --domain=user \
        --action notify
 
-test_success "--condition event-rule-matches -u" \
-       --condition event-rule-matches -u \
+test_success "--condition event-rule-matches --domain=user" \
+       --condition event-rule-matches --domain=user \
        --action notify
 
 test_success "notify action polices" \
-       --condition event-rule-matches -u --name=test-rate-policy \
+       --condition event-rule-matches --domain=user --name=test-rate-policy \
        --action notify \
        --rate-policy=every:55 \
        --action notify \
        --rate-policy=once-after:55
 
 test_success "start session action polices" \
-       --condition event-rule-matches -u --name=test-rate-policy \
+       --condition event-rule-matches --domain=user --name=test-rate-policy \
        --action start-session my_session \
        --rate-policy=every:55 \
        --action start-session my_session \
        --rate-policy=once-after:55
 
 test_success "stop session action polices" \
-       --condition event-rule-matches -u --name=test-rate-policy \
+       --condition event-rule-matches --domain=user --name=test-rate-policy \
        --action stop-session my_session \
        --rate-policy=every:55 \
        --action stop-session my_session \
        --rate-policy=once-after:55
 
 test_success "snapshot session action polices" \
-       --condition event-rule-matches -u --name=test-rate-policy \
+       --condition event-rule-matches --domain=user --name=test-rate-policy \
        --action snapshot-session my_session \
        --rate-policy=every:55 \
        --action snapshot-session my_session \
        --rate-policy=once-after:55
 
 test_success "rotate session action polices" \
-       --condition event-rule-matches -u --name=test-rate-policy \
+       --condition event-rule-matches --domain=user --name=test-rate-policy \
        --action rotate-session my_session \
        --rate-policy=every:55 \
        --action rotate-session my_session \
@@ -128,7 +128,7 @@ test_success "rotate session action polices" \
 
 skip $ist_root "non-root user: skipping kprobe tests" 9 || {
        test_success "--condition event-rule-matches probe by symbol" \
-               --condition event-rule-matches -k --probe=lttng_channel_enable --event-name=my_channel_enable \
+               --condition event-rule-matches --domain=kernel --probe=lttng_channel_enable --event-name=my_channel_enable \
                --action notify
 
        channel_enable_addr=$(grep ' t lttng_channel_enable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
@@ -148,101 +148,101 @@ skip $ist_root "non-root user: skipping kprobe tests" 9 || {
        offset_hex="0x$(printf '%x' $offset)"
 
        test_success "--condition event-rule-matches probe by symbol with offset" \
-               --condition event-rule-matches -k --probe="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
+               --condition event-rule-matches --domain=kernel --probe="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
                --action notify
 
        test_success "--condition event-rule-matches probe by address" \
-               --condition event-rule-matches -k "--probe=0x${channel_enable_addr}" --event-name=my_channel_enable \
+               --condition event-rule-matches --domain=kernel "--probe=0x${channel_enable_addr}" --event-name=my_channel_enable \
                --action notify
 }
 
 skip $ist_root "non-root user: skipping uprobe tests" 6 || {
        test_success "--condition event-rule-matches uprobe" \
-               --condition event-rule-matches -k --userspace-probe=${uprobe_elf_binary}:test_function --event-name=ma-probe \
+               --condition event-rule-matches --domain=kernel --userspace-probe=${uprobe_elf_binary}:test_function --event-name=ma-probe \
                --action notify
 
        test_success "--condition event-rule-matches uprobe with elf prefix" \
-               --condition event-rule-matches -k --userspace-probe=elf:${uprobe_elf_binary}:test_function --event-name=ma-probe-2 \
+               --condition event-rule-matches --domain=kernel --userspace-probe=elf:${uprobe_elf_binary}:test_function --event-name=ma-probe-2 \
                --action notify
 }
 
 skip $ist_root "non-root user: skipping syscall tests" 9 || {
        test_success "--condition event-rule-matches one syscall" \
-               --condition event-rule-matches -k --syscall --name=open \
+               --condition event-rule-matches --domain=kernel --syscall --name=open \
                --action notify
 
        test_success "--condition event-rule-matches all syscalls" \
-               --condition event-rule-matches -k --syscall \
+               --condition event-rule-matches --domain=kernel --syscall \
                --action notify
 
        test_success "--condition event-rule-matches one syscall with filter" \
-               --condition event-rule-matches -k --syscall --filter 'a > 2' --name=open \
+               --condition event-rule-matches --domain=kernel --syscall --filter 'a > 2' --name=open \
                --action notify
 }
 
 # `--action notify` successes
 test_success "--action notify" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action notify
 
 test_success "--action notify --capture foo" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture foo --action notify
 
 test_success "--action notify --capture foo[2]" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture 'foo[2]' --action notify
 
 test_success '--action notify --capture $ctx.foo' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$ctx.foo' --action notify
 
 test_success '--action notify --capture $ctx.foo[2]' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$ctx.foo[2]' --action notify
 
 test_success '--action notify --capture $app.prov:type' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$app.prov:type' --action notify
 
 test_success '--action notify --capture $app.prov:type[2]' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$app.prov:type[2]' --action notify
 
 test_success '--action notify multiple captures' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture foo --capture '$app.hello:world' --action notify
 
 # `--action start-session` successes
 test_success "--action start-session" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action start-session ze-session
 
 # `--action stop-session` successes
 test_success "--action stop-session foo" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action stop-session ze-session
 
 # `--action rotate-session` successes
 test_success "--action rotate-session foo" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action rotate-session ze-session
 
 # `--action snapshot-session` successes
 test_success "--action snapshot-session foo" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session
 
 test_success "--action snapshot-session with file URI" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --path /hello
 
 test_success "--action snapshot-session with net URI" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --url net://1.2.3.4
 
 test_success "--action snapshot-session with ctrl/data URIs" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1234 --data-url=tcp://1.2.3.4:1235
 
 # top-level failures
@@ -254,12 +254,12 @@ test_failure "unknown option" \
 
 test_failure "missing --action" \
        "Error: Need at least one --action." \
-       --condition event-rule-matches -u
+       --condition event-rule-matches --domain=user
 
 test_failure "two --condition" \
        "Error: A --condition was already given." \
-       --condition event-rule-matches --name=aaa -u \
-       --condition event-rule-matches --name=bbb -u \
+       --condition event-rule-matches --name=aaa --domain=user \
+       --condition event-rule-matches --name=bbb --domain=user \
        --action notify
 
 test_failure "missing argument to --name" \
@@ -269,23 +269,23 @@ test_failure "missing argument to --name" \
 for cmd in rate-policy=once-after rate-policy=every; do
        test_failure "missing argument to --${cmd}" \
                "Error: Rate policy format is invalid." \
-               --condition event-rule-matches -u --action notify \
+               --condition event-rule-matches --domain=user --action notify \
                --${cmd}
 
        test_failure "invalid argument to --${cmd}: non-digit character" \
                "Error: Failed to parse rate policy value \`123bob\` as an integer." \
-               --condition event-rule-matches -u --action notify \
+               --condition event-rule-matches --domain=user --action notify \
                --${cmd}:123bob
 
        test_failure "invalid argument to --${cmd}: empty string" \
                "Error: Failed to parse rate policy value \`\` as an integer." \
-               --condition event-rule-matches -u --action notify \
+               --condition event-rule-matches --domain=user --action notify \
                --${cmd}":"
 done
 
 test_failure "invalid argument to --rate-policy: unknown policy type" \
        "Error: Rate policy type \`bob\` unknown." \
-       --condition event-rule-matches -u --action notify \
+       --condition event-rule-matches --domain=user --action notify \
        --rate-policy=bob:123
 
 # `--condition` failures
@@ -298,12 +298,20 @@ test_failure "unknown --condition" \
 
 # `--condition event-rule-matches` failures
 test_failure "missing args after --condition event-rule-matches" \
-       "Error: Please specify a domain (--kernel/--userspace/--jul/--log4j/--python)." \
+       "Error: Please specify a domain (--domain=(kernel,user,jul,log4j,python))." \
        --condition event-rule-matches
 
 test_failure "extra args after --condition event-rule-matches" \
        "Error: Unexpected argument 'bozo'" \
-       --condition event-rule-matches -u bozo
+       --condition event-rule-matches --domain=user bozo
+
+test_failure "two same --domain" \
+       "Error: More than one \`--domain\` was specified." \
+       --condition event-rule-matches --domain=user --domain=user
+
+test_failure "two different --domain" \
+       "Error: More than one \`--domain\` was specified." \
+       --condition event-rule-matches --domain=user --domain=kernel
 
 test_failure "--condition event-rule-matches: --name with --probe" \
        "Error: Can't use --name with probe event rules." \
@@ -311,127 +319,127 @@ test_failure "--condition event-rule-matches: --name with --probe" \
 
 test_failure "--condition event-rule-matches: --event-name with tracepoint" \
        "Error: Can't use --event-name with tracepoint event rules." \
-       --condition event-rule-matches -u --event-name='hello'
+       --condition event-rule-matches --domain=user --event-name='hello'
 
 test_failure "--condition event-rule-matches: extra argument with --userspace-probe" \
        "Error: Unexpected argument 'hello'" \
-       --condition event-rule-matches -k --userspace-probe=${uprobe_elf_binary}:test_failure hello
+       --condition event-rule-matches --domain=kernel --userspace-probe=${uprobe_elf_binary}:test_failure hello
 
 test_failure "--condition event-rule-matches: extra argument with --syscall" \
        "Error: Unexpected argument 'open'" \
-       --condition event-rule-matches -k --syscall open
+       --condition event-rule-matches --domain=kernel --syscall open
 
 test_failure "--condition event-rule-matches --capture: missing argument (end of arg list)" \
        'Error: While parsing argument #2 (`--capture`): Missing required argument for option `--capture`' \
        --action notify \
-       --condition event-rule-matches -u --capture
+       --condition event-rule-matches --domain=user --capture
 
 test_failure "--condition event-rule-matches --capture: missing argument (before another option)" \
        'Error: While parsing expression `--action`: Unary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches -u --capture \
+       --condition event-rule-matches --domain=user --capture \
        --action notify \
 
 test_failure "--condition event-rule-matches --capture: binary operator" \
        'Error: While parsing expression `foo == 2`: Binary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture 'foo == 2' --action notify
 
 test_failure "--condition event-rule-matches --capture: unary operator" \
        'Error: While parsing expression `!foo`: Unary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '!foo' --action notify
 
 test_failure "--condition event-rule-matches --capture: logical operator" \
        'Error: While parsing expression `foo || bar`: Logical operators are not allowed in capture expressions.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture 'foo || bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: accessing a sub-field" \
        'Error: While parsing expression `foo.bar`: Capturing subfields is not supported.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture 'foo.bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: accessing the sub-field of an array element" \
        'Error: While parsing expression `foo[3].bar`: Capturing subfields is not supported.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture 'foo[3].bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
        'Error: Invalid app-specific context field name: missing colon in `foo`.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$app.foo' --action notify
 
 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
        'Error: Invalid app-specific context field name: missing type name after colon in `foo:`.' \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --capture '$app.foo:' --action notify
 
 # `--action` failures
 test_failure "missing args after --action" \
        "Error: While parsing argument #1 (\`--action\`): Missing required argument for option \`--action\`" \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action
 
 # `--action notify` failures
 test_failure "extra arg after --action notify" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action notify bob
 
 # `--action start-session` failures
 test_failure "missing arg after --action start-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action start-session
 test_failure "extra arg after --action start-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action start-session ze-session bob
 
 # `--action stop-session` failures
 test_failure "missing arg after --action stop-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action stop-session
 test_failure "extra arg after --action stop-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action stop-session ze-session bob
 
 # `--action rotate-session` failures
 test_failure "missing arg after --action rotate-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action rotate-session
 test_failure "extra arg after --action rotate-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action rotate-session ze-session bob
 
 # `--action snapshot-session` failures
 test_failure "missing arg after --action snapshot-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session
 test_failure "extra arg after --action snapshot-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session bob
 test_failure "snapshot-session action, --max-size without destination" \
        "Error: Can't provide a snapshot output max size without a snapshot output destination." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --max-size 10M
 test_failure "snapshot-session action, --name without destination" \
        "Error: Can't provide a snapshot output name without a snapshot output destination." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --name hallo
 test_failure "snapshot-session action, --name with-local-path-instead-of-url" \
        "Error: Failed to parse '/something/that/looks/like/a/path' as an URL." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --name hallo --url /something/that/looks/like/a/path
 test_failure "snapshot-session action, --name with-net-url-instead-of-path" \
        "Error: Failed to parse 'net://8.8.8.8/' as a local path." \
-       --condition event-rule-matches -u \
+       --condition event-rule-matches --domain=user \
        --action snapshot-session ze-session --name hallo --path net://8.8.8.8/
 
 # Cleanup
index e023f3fd919d2dfc975f24362c71240f4ece99af..af0885d8555f2389ef37d04de10e8f0cb65cd8d2 100755 (executable)
@@ -70,7 +70,7 @@ test_top_level_options ()
 {
        diag "Listing top level options"
 
-       lttng_add_trigger_ok "hello" --condition event-rule-matches -u --name=test-name --action notify
+       lttng_add_trigger_ok "hello" --condition event-rule-matches --domain=user --name=test-name --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: hello
@@ -92,15 +92,15 @@ test_on_event_tracepoint ()
 {
        diag "Listing on-event tracepoint"
 
-       lttng_add_trigger_ok "C" --condition event-rule-matches -u --action notify
-       lttng_add_trigger_ok "A" --condition event-rule-matches --name=aaa -u --filter 'p == 2' --action notify
-       lttng_add_trigger_ok "D" --condition event-rule-matches --name='hello*' -u -x 'hello2,hello3,hello4' --action notify
-       lttng_add_trigger_ok "B" --condition event-rule-matches -u --name=gerboise --loglevel INFO --action notify
-       lttng_add_trigger_ok "E" --condition event-rule-matches -u --name=lemming --loglevel-only WARNING --action notify
-       lttng_add_trigger_ok "F" --condition event-rule-matches -u --name=capture-payload-field --capture a --action notify
-       lttng_add_trigger_ok "G" --condition event-rule-matches -u --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
-       lttng_add_trigger_ok "H" --condition event-rule-matches -u --name=capture-chan-ctx --capture '$ctx.vpid' --action notify
-       lttng_add_trigger_ok "I" --condition event-rule-matches -u --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify
+       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 "B" --condition event-rule-matches --domain=user --name=gerboise --loglevel INFO --action notify
+       lttng_add_trigger_ok "E" --condition event-rule-matches --domain=user --name=lemming --loglevel-only WARNING --action notify
+       lttng_add_trigger_ok "F" --condition event-rule-matches --domain=user --name=capture-payload-field --capture a --action notify
+       lttng_add_trigger_ok "G" --condition event-rule-matches --domain=user --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
+       lttng_add_trigger_ok "H" --condition event-rule-matches --domain=user --name=capture-chan-ctx --capture '$ctx.vpid' --action notify
+       lttng_add_trigger_ok "I" --condition event-rule-matches --domain=user --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: A
@@ -222,9 +222,9 @@ test_on_event_probe ()
 
        offset_hex="0x$(printf '%x' $offset)"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches -k --probe=lttng_channel_enable --event-name=my_channel_enable --action notify
-       lttng_add_trigger_ok "T1" --condition event-rule-matches -k --probe="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify
-       lttng_add_trigger_ok "T2" --condition event-rule-matches -k --probe="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --probe=lttng_channel_enable --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --probe="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=kernel --probe="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -266,7 +266,7 @@ test_on_event_userspace_probe_elf ()
 
        diag "Listing on-event userspace-probe elf"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches -k --userspace-probe=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --userspace-probe=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -313,8 +313,8 @@ test_on_event_syscall ()
 {
        diag "Listing on-event syscall"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches -k --syscall --name=open --action notify
-       lttng_add_trigger_ok "T1" --condition event-rule-matches -k --syscall --name=ptrace --filter 'a > 2' --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --syscall --name=open --action notify
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --syscall --name=ptrace --filter 'a > 2' --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -345,16 +345,16 @@ test_snapshot_action ()
 {
        diag "Listing snapshot actions"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session
-       lttng_add_trigger_ok "T1" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --path /some/path
-       lttng_add_trigger_ok "T2" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --url file:///some/other/path
-       lttng_add_trigger_ok "T3" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --url net://1.2.3.4
-       lttng_add_trigger_ok "T4" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
-       lttng_add_trigger_ok "T5" --condition event-rule-matches -u --name=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 event-rule-matches -u --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234
-       lttng_add_trigger_ok "T7" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --path /some/path --name=meh
-       lttng_add_trigger_ok "T8" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --rate-policy=every:10
-       lttng_add_trigger_ok "T9" --condition event-rule-matches -u --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path
+       lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url file:///some/other/path
+       lttng_add_trigger_ok "T3" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4
+       lttng_add_trigger_ok "T4" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
+       lttng_add_trigger_ok "T5" --condition event-rule-matches --domain=user --name=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 event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234
+       lttng_add_trigger_ok "T7" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --name=meh
+       lttng_add_trigger_ok "T8" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=every:10
+       lttng_add_trigger_ok "T9" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -455,8 +455,8 @@ test_snapshot_action ()
 
 test_notify_action ()
 {
-       lttng_add_trigger_ok "T0" --condition event-rule-matches -u --name=some-event --action notify --rate-policy=once-after:5
-       lttng_add_trigger_ok "T1" --condition event-rule-matches -u --name=some-event --action notify --rate-policy=every:10
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=once-after:5
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=every:10
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
index 5f3dffc4e1471855c4596437a16748bf96940908..fbfc202b6d50271eef297fe68be0aef3058af1d8 100755 (executable)
@@ -68,8 +68,8 @@ function remove_trigger ()
 start_lttng_sessiond_notap
 
 # Add a few triggers
-lttng_add_trigger_ok "ABC" --condition event-rule-matches --name=aaa -u --filter 'p == 2' --action notify
-lttng_add_trigger_ok "DEF" --condition event-rule-matches -u --action notify
+lttng_add_trigger_ok "ABC" --condition event-rule-matches --name=aaa --domain=user --filter 'p == 2' --action notify
+lttng_add_trigger_ok "DEF" --condition event-rule-matches --domain=user --action notify
 
 cat > "${tmp_expected_stdout}" <<- EOF
 - name: ABC
This page took 0.045629 seconds and 4 git commands to generate.