Fix: create lttng run dir regardless of user privilege
[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)
63f1709b 39PAGE_SIZE=$(getconf PAGE_SIZE)
434f8068
JR
40
41DIR=$(readlink -f $TESTDIR)
42
43source $TESTDIR/utils/utils.sh
44
45consumerd_pipe=()
46
47file_sync_after_first_event=$(mktemp -u)
48
49LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
50start_lttng_sessiond_notap
51
52create_lttng_session_notap $SESSION_NAME $TRACE_PATH
53
63f1709b 54enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
434f8068
JR
55enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
56
57#This is needed since the testpoint create a pipe with the consumer type suffixed
58for f in "$TESTPOINT_BASE_PATH"*; do
59 consumerd_pipe+=("$f")
60done
61
62
63# Start app in infinite loop
64$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $file_sync_after_first_event &
65APP_PID=$!
66# Pin to CPU zero to force specific sub buffer usage
67taskset -p -c 0 $APP_PID > /dev/null 2>&1
68
69while [ ! -f "${file_sync_after_first_event}" ]; do
70 sleep 0.5
71done
72rm ${file_sync_after_first_event}
73
74# The actual test suite
75# TODO: Add support for kernel domain
76$CURDIR/notification $SESSION_NAME $CHANNEL_NAME LTTNG_DOMAIN_UST ${consumerd_pipe[@]}
77
78stop_lttng_sessiond_notap
79
80# On ungraceful kill the app is cleaned up via the full_cleanup call
81# Suppress kill message
82kill -9 $APP_PID
83wait $APP_PID 2> /dev/null
84
85# Just in case cleanup
86rm -rf $TRACE_PATH
87rm ${consumerd_pipe[@]} 2> /dev/null
This page took 0.026822 seconds and 5 git commands to generate.