SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / tests / regression / tools / notification / test_notification_ust_buffer_usage
1 #!/bin/bash
2 #
3 # Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
6
7 CURDIR=$(dirname "$0")/
8 TESTDIR=$CURDIR/../../../
9
10 TMPDIR=$(mktemp -d)
11
12 #This is needed since the testpoint create a pipe with the consumerd type suffixed
13 TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
14 TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
15 TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so")
16
17 TESTAPP_PATH="$TESTDIR/utils/testapp"
18
19 GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
20 GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
21
22 TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
23
24 SESSION_NAME="my_session"
25 CHANNEL_NAME="my_channel"
26
27 TRACE_PATH=$(mktemp -d)
28 PAGE_SIZE=$(getconf PAGE_SIZE)
29
30 # shellcheck source=../../../utils/utils.sh
31 source "$TESTDIR/utils/utils.sh"
32 # shellcheck source=./util_event_generator.sh
33 source "$CURDIR/util_event_generator.sh"
34
35 function test_buffer_usage_notification
36 {
37 consumerd_pipe=()
38 event_name="tp:tptest"
39
40 create_lttng_session_notap $SESSION_NAME "$TRACE_PATH"
41
42 enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size="$PAGE_SIZE"
43 enable_ust_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
44
45 # This is needed since the testpoint create a pipe with the consumer type suffixed
46 for f in "$TESTPOINT_BASE_PATH"*; do
47 consumerd_pipe+=("$f")
48 done
49
50 ust_event_generator "$GEN_UST_EVENTS_TESTAPP_BIN" "$TESTAPP_STATE_PATH" &
51 APP_PID=$!
52
53 "$CURDIR/notification" 2 LTTNG_DOMAIN_UST $APP_PID "$TESTAPP_STATE_PATH" \
54 $SESSION_NAME $CHANNEL_NAME "${consumerd_pipe[@]}"
55
56 destroy_lttng_session_notap $SESSION_NAME
57
58 # On ungraceful kill the app is cleaned up via the full_cleanup call
59 # Suppress kill message
60 kill -SIGUSR2 $APP_PID
61 wait $APP_PID 2> /dev/null
62
63 # Just in case cleanup
64 rm -rf "$TRACE_PATH"
65 }
66
67 LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
68 start_lttng_sessiond_notap
69
70 test_buffer_usage_notification
71
72 stop_lttng_sessiond_notap
73
74 rm -rf "$TMPDIR"
This page took 0.046211 seconds and 5 git commands to generate.