Add condition-targeting error query
[lttng-tools.git] / tests / regression / tools / notification / test_notification_notifier_discarded_count
index 5f2754362b7a7678e6edb964a31c9cda5e482cf0..c9235393ef27cfba645d62eb0f5be132a432ba60 100755 (executable)
@@ -7,14 +7,14 @@
 CURDIR=$(dirname "$0")/
 TESTDIR=$CURDIR/../../../
 
-TMPDIR=$(mktemp -d)
+TEST_TMPDIR=$(mktemp --tmpdir -d tmp.test_notifier_discarded_count.XXXXXX)
 
 TESTAPP_PATH="$TESTDIR/utils/testapp"
 TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 
-TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
-TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
+TESTPOINT_BASE_PATH=$(readlink -f "$TEST_TMPDIR/lttng.t_p_n")
+TESTPOINT_PIPE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "lttng.t_p_n.XXXXXX")
 TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_sessiond.so")
 
 SH_TAP=1
@@ -37,17 +37,17 @@ plan_tests $NUM_TESTS
 function trigger_get_discarded_notif_number()
 {
        local trigger_name="$1"
-       local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX)
+       local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX")
 
        "$FULL_LTTNG_BIN" list-triggers > "$list_triggers_stdout"
 
-       cat "$list_triggers_stdout" | grep -a7 "$trigger_name" | tail -1 | grep --quiet "errors: none"
+       cat "$list_triggers_stdout" | grep -A7 "$trigger_name" | grep -A2 "event rule matches" | tail -1 | grep --quiet "errors: none"
        ret=$?
 
        if [ "$ret" -eq "0" ]; then
                notif_nb="0"
        else
-               notif_nb=$(cat "$list_triggers_stdout" | grep -a8 "$trigger_name" | tail -1 | grep "discarded tracer messages" | cut -d' ' -f8)
+               notif_nb=$(cat "$list_triggers_stdout" | grep -A7 "$trigger_name" | grep "discarded tracer messages" | cut -d' ' -f10)
        fi
 
        rm -f "$list_triggers_stdout"
@@ -60,7 +60,7 @@ function test_kernel_notifier_discarded_count
 {
        local sessiond_pipe=()
        local trigger_name="my_trigger"
-       local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX)
+       local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX")
 
        # Used on sessiond launch.
        LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
@@ -78,7 +78,7 @@ function test_kernel_notifier_discarded_count
        done
 
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --domain=kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --type=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 --domain=kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --type=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 --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=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 --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=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 --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=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 --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=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 --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=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 --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=user --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
@@ -244,7 +244,7 @@ function test_ust_notifier_discarded_count_multi_uid
        local sessiond_pipe=()
        local root_trigger_name="root_trigger"
        local user_trigger_name="user_trigger"
-       local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX)
+       local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX")
        local NR_USEC_WAIT=0
        local PIPE_SIZE
        local NR_ITER
@@ -284,11 +284,11 @@ function test_ust_notifier_discarded_count_multi_uid
        done
 
        lttng_add_trigger_ok "$root_trigger_name" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        lttng_add_trigger_ok "$user_trigger_name" --owner-uid "$new_uid" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        # Stop consumption of notifier tracer notifications.
@@ -324,7 +324,7 @@ function test_ust_notifier_discarded_regardless_trigger_owner
        local sessiond_pipe=()
        local root_trigger_name="root_trigger"
        local user_trigger_name="user_trigger"
-       local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX)
+       local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX")
        local NR_USEC_WAIT=0
        local PIPE_SIZE
        local NR_ITER
@@ -364,7 +364,7 @@ function test_ust_notifier_discarded_regardless_trigger_owner
        done
 
        lttng_add_trigger_ok "$root_trigger_name" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        # Stop consumption of notifier tracer notifications.
@@ -418,4 +418,4 @@ else
        skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS
 fi
 
-rm -rf "$TMPDIR"
+rm -rf "$TEST_TMPDIR"
This page took 0.027348 seconds and 4 git commands to generate.