Tests: Fix: Use '.logfile' instead of '.log' for test app output
[lttng-tools.git] / tests / regression / tools / notification / test_notification_ust_buffer_usage
CommitLineData
069fc1c5
FD
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
7CURDIR=$(dirname "$0")/
8TESTDIR=$CURDIR/../../../
9
8d5a3312
MJ
10TEST_TMPDIR=$(mktemp -d -t tmp.test_notif_ust_buffer_usage_dir.XXXXXX)
11
12# Set TMPDIR for further call to mktemp
13export TMPDIR="$TEST_TMPDIR"
069fc1c5 14
33e55711 15set -x
069fc1c5 16#This is needed since the testpoint create a pipe with the consumerd type suffixed
33e55711 17TESTPOINT_BASE_PATH=$(readlink -f "$TEST_TMPDIR/lttng.t_p_n")
8d5a3312 18TESTPOINT_PIPE_PATH=$(mktemp -u -t "lttng.t_p_n.XXXXXX")
069fc1c5
FD
19TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so")
20
21TESTAPP_PATH="$TESTDIR/utils/testapp"
22
23GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
24GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
25
8d5a3312 26TESTAPP_STATE_PATH=$(mktemp -u -t "application_state.XXXXXXXXXX")
069fc1c5
FD
27
28SESSION_NAME="my_session"
29CHANNEL_NAME="my_channel"
30
8d5a3312 31TRACE_PATH=$(mktemp -d -t "trace_path.XXXXXX")
069fc1c5 32PAGE_SIZE=$(getconf PAGE_SIZE)
33e55711 33set +x
069fc1c5
FD
34
35# shellcheck source=../../../utils/utils.sh
36source "$TESTDIR/utils/utils.sh"
25cb2044
JR
37# shellcheck source=./util_event_generator.sh
38source "$CURDIR/util_event_generator.sh"
069fc1c5
FD
39
40function test_buffer_usage_notification
41{
42 consumerd_pipe=()
43 event_name="tp:tptest"
44
45 create_lttng_session_notap $SESSION_NAME "$TRACE_PATH"
46
47 enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size="$PAGE_SIZE"
48 enable_ust_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
49
50 # This is needed since the testpoint create a pipe with the consumer type suffixed
51 for f in "$TESTPOINT_BASE_PATH"*; do
52 consumerd_pipe+=("$f")
53 done
54
25cb2044 55 ust_event_generator "$GEN_UST_EVENTS_TESTAPP_BIN" "$TESTAPP_STATE_PATH" &
069fc1c5
FD
56 APP_PID=$!
57
a740a242
FD
58 "$CURDIR/notification" 2 LTTNG_DOMAIN_UST $APP_PID "$TESTAPP_STATE_PATH" \
59 $SESSION_NAME $CHANNEL_NAME "${consumerd_pipe[@]}"
069fc1c5
FD
60
61 destroy_lttng_session_notap $SESSION_NAME
62
63 # On ungraceful kill the app is cleaned up via the full_cleanup call
64 # Suppress kill message
25cb2044 65 kill -SIGUSR2 $APP_PID
069fc1c5
FD
66 wait $APP_PID 2> /dev/null
67
68 # Just in case cleanup
69 rm -rf "$TRACE_PATH"
70}
71
72LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
73start_lttng_sessiond_notap
74
75test_buffer_usage_notification
76
77stop_lttng_sessiond_notap
78
33e55711 79rm -rf "$TEST_TMPDIR"
This page took 0.058374 seconds and 5 git commands to generate.