+ "User trigger discarded notifications number ($user_trigger_discarded_nb) is non-zero"
+
+ lttng_remove_trigger_ok "$root_trigger_name"
+ lttng_remove_trigger_ok "$user_trigger_name" --owner-uid "$new_uid"
+
+ stop_lttng_sessiond_notap
+
+ unset LTTNG_SESSIOND_ENV_VARS
+
+ userdel "$new_user"
+ rm -f "$list_triggers_stdout"
+}
+
+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 NR_USEC_WAIT=0
+ local PIPE_SIZE
+ local NR_ITER
+ local new_user="dummy_lttng_test_user"
+
+ PIPE_SIZE=$(get_pipe_max_size)
+
+ # Find the number of events needed to overflow the event notification
+ # pipe buffer. Each LTTng-UST notification is at least 42 bytes long.
+ # Double that number to ensure enough events are created to overflow
+ # the buffer.
+ NR_ITER=$(( (PIPE_SIZE / 42) * 2 ))
+ diag "Test applications will emit $NR_ITER events"
+
+ diag "UST event notifer error counter persists when a root trigger is present"
+
+ # Create a dummy user to run test apps as.
+ useradd --no-create-home "$new_user"
+ new_uid=$(id -u "$new_user")
+
+ # Used on sessiond launch.
+ LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
+ NOTIFIER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
+ LD_PRELOAD=${TESTPOINT}"
+
+ start_lttng_sessiond_notap
+
+ # This is needed since the testpoint create a pipe with the sessiond
+ # type suffixed.
+ for f in "$TESTPOINT_BASE_PATH"*; do
+ sessiond_pipe+=("$f")
+ done
+
+ lttng_add_trigger_ok "$root_trigger_name" \
+ --condition event-rule-matches --type=user --name tp:tptest \
+ --action notify
+
+ # Stop consumption of notifier tracer notifications.
+ echo -n 1 > $sessiond_pipe
+
+ su "$new_user" -c "$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT"
+ ok $? "Generating $NR_ITER tracer notifications as UID: $new_uid"
+
+ root_trigger_discarded_nb=$(trigger_get_discarded_notif_number "$root_trigger_name")
+
+ isnt $root_trigger_discarded_nb 0 \
+ "Root trigger discarded notifications number ($root_trigger_discarded_nb) is non-zero"