Cleanup: tests: use find's `-name` option instead of grep
[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
10TMPDIR=$(mktemp -d)
11
12#This is needed since the testpoint create a pipe with the consumerd type suffixed
13TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
14TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
15TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so")
16
17TESTAPP_PATH="$TESTDIR/utils/testapp"
18
19GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
20GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
21
22TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
23
24SESSION_NAME="my_session"
25CHANNEL_NAME="my_channel"
26
27TRACE_PATH=$(mktemp -d)
28PAGE_SIZE=$(getconf PAGE_SIZE)
29
30# shellcheck source=../../../utils/utils.sh
31source "$TESTDIR/utils/utils.sh"
25cb2044
JR
32# shellcheck source=./util_event_generator.sh
33source "$CURDIR/util_event_generator.sh"
069fc1c5
FD
34
35function 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
25cb2044 50 ust_event_generator "$GEN_UST_EVENTS_TESTAPP_BIN" "$TESTAPP_STATE_PATH" &
069fc1c5
FD
51 APP_PID=$!
52
a740a242
FD
53 "$CURDIR/notification" 2 LTTNG_DOMAIN_UST $APP_PID "$TESTAPP_STATE_PATH" \
54 $SESSION_NAME $CHANNEL_NAME "${consumerd_pipe[@]}"
069fc1c5
FD
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
25cb2044 60 kill -SIGUSR2 $APP_PID
069fc1c5
FD
61 wait $APP_PID 2> /dev/null
62
63 # Just in case cleanup
64 rm -rf "$TRACE_PATH"
65}
66
67LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
68start_lttng_sessiond_notap
69
70test_buffer_usage_notification
71
72stop_lttng_sessiond_notap
73
74rm -rf "$TMPDIR"
This page took 0.027294 seconds and 4 git commands to generate.