Tests: regression testing for notification API
[lttng-tools.git] / tests / regression / tools / notification / test_notification
CommitLineData
434f8068
JR
1#!/bin/bash
2#
3# Copyright (C) - 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4#
5# This library is free software; you can redistribute it and/or modify it under
6# the terms of the GNU Lesser General Public License as published by the Free
7# Software Foundation; version 2.1 of the License.
8#
9# This library is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12# details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this library; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18CURDIR=$(dirname $0)/
19TESTDIR=$CURDIR/../../../
20
21#This is needed since the testpoint create a pipe with the consumerd type suffixed
22TESTPOINT_BASE_PATH=$(readlink -f "$CURDIR/lttng.t_p_n")
23TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
24TESTPOIT_ARGS="CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LTTNG_TESTPOINT_ENABLE=1"
25TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
26
27TESTAPP_PATH="$TESTDIR/utils/testapp"
28TESTAPP_NAME="gen-ust-events"
29TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
30
31NR_ITER=-1
32NR_USEC_WAIT=5
33
34SESSION_NAME="my_session"
35CHANNEL_NAME="my_ust_channel"
36EVENT_NAME="tp:tptest"
37
38TRACE_PATH=$(mktemp -d)
39
40DIR=$(readlink -f $TESTDIR)
41
42source $TESTDIR/utils/utils.sh
43
44consumerd_pipe=()
45
46file_sync_after_first_event=$(mktemp -u)
47
48LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
49start_lttng_sessiond_notap
50
51create_lttng_session_notap $SESSION_NAME $TRACE_PATH
52
53enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=4096
54enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
55
56#This is needed since the testpoint create a pipe with the consumer type suffixed
57for f in "$TESTPOINT_BASE_PATH"*; do
58 consumerd_pipe+=("$f")
59done
60
61
62# Start app in infinite loop
63$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $file_sync_after_first_event &
64APP_PID=$!
65# Pin to CPU zero to force specific sub buffer usage
66taskset -p -c 0 $APP_PID > /dev/null 2>&1
67
68while [ ! -f "${file_sync_after_first_event}" ]; do
69 sleep 0.5
70done
71rm ${file_sync_after_first_event}
72
73# The actual test suite
74# TODO: Add support for kernel domain
75$CURDIR/notification $SESSION_NAME $CHANNEL_NAME LTTNG_DOMAIN_UST ${consumerd_pipe[@]}
76
77stop_lttng_sessiond_notap
78
79# On ungraceful kill the app is cleaned up via the full_cleanup call
80# Suppress kill message
81kill -9 $APP_PID
82wait $APP_PID 2> /dev/null
83
84# Just in case cleanup
85rm -rf $TRACE_PATH
86rm ${consumerd_pipe[@]} 2> /dev/null
This page took 0.02859 seconds and 5 git commands to generate.