3 # Copyright (C) - 2013 David Goulet <dgoulet@efficios.com>
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. details.
9 # You should have received a copy of the GNU Lesser General Public License
10 # along with this library; if not, write to the Free Software Foundation, Inc.,
11 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 LAUNCH_APP
="launch_ust_app"
17 EVENT_NAME
="tp:tptest"
18 LOG_FILE_SESSIOND
="sessiond.log"
19 LOG_FILE_RELAYD
="relayd.log"
20 CHANNEL_NAME
="channel0"
24 COREDUMP_FILE
=$
(cat /proc
/sys
/kernel
/core_pattern
)
28 TEST_DESC
="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps"
30 source $TESTDIR/utils
/utils.sh
32 # MUST set TESTDIR before calling those functions
34 function enable_channel_per_uid
()
39 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
--buffers-uid -u $channel_name -s $sess_name >/dev
/null
2>&1
40 ok $?
"Enable channel $channel_name per UID for session $sess_name"
43 function check_sessiond
()
45 if [ -z "$(pgrep --full lt-lttng-sessiond)" ]; then
46 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
48 diag
"!!!The session daemon died unexpectedly!!!"
49 mv $LOG_FILE_SESSIOND $LOG_FILE_SESSIOND-$str_date
50 if [ -e $COREDUMP_FILE ]; then
51 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
57 function check_relayd
()
59 if [ -z "$(pgrep --full lt-lttng-relayd)" ]; then
60 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
62 diag
"!!!The relay daemon died unexpectedly!!!"
63 mv $LOG_FILE_RELAYD $LOG_FILE_RELAYD-$str_date
64 if [ -e $COREDUMP_FILE ]; then
65 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
71 function start_sessiond
()
73 local SESSIOND_BIN
="lttng-sessiond"
75 validate_kernel_version
77 fail
"Start session daemon"
78 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
81 if [ -z $
(pgrep
--full lt-
$SESSIOND_BIN) ]; then
82 # We have to start it like this so the ulimit -c is used by this
83 # process. Also, we collect any error message printed out.
84 $TESTDIR/..
/src
/bin
/lttng-sessiond
/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
86 ok
$status "Start session daemon"
93 local RELAYD_BIN
="lttng-relayd"
95 if [ -z $
(pgrep
--full lt-
$RELAYD_BIN) ]; then
96 $TESTDIR/..
/src
/bin
/lttng-relayd
/$RELAYD_BIN $opt >$LOG_FILE_RELAYD 2>&1 &
97 ok $?
"Start lttng-relayd (opt: \"$opt\")"
103 for b
in $
(seq 1 $NR_LOOP); do
104 for a
in $
(seq 1 $NR_SESSION); do
105 create_lttng_session_uri
$SESSION_NAME-$a net
://localhost
108 enable_channel_per_uid
$SESSION_NAME-$a $CHANNEL_NAME
111 enable_ust_lttng_event_ok
$SESSION_NAME-$a $EVENT_NAME
114 start_lttng_tracing_ok
$SESSION_NAME-$a
119 for a
in $
(seq 1 $NR_SESSION); do
120 stop_lttng_tracing_ok
$SESSION_NAME-$a
123 destroy_lttng_session_ok
$SESSION_NAME-$a
135 for p
in ${APPS_PID}; do
137 wait ${p} 2>/dev
/null
144 function sighandler
()
147 rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
151 trap sighandler SIGINT
152 trap sighandler SIGTERM
154 # Make sure we collect a coredump if possible.
157 # MUST set TESTDIR before calling those functions
158 plan_tests
$NUM_TESTS
160 print_test_banner
"$TEST_DESC"
162 TRACE_PATH
=$
(mktemp
-d)
164 start_relayd
"-o $TRACE_PATH"
167 diag
"Starting applications launcher"
169 # Start NR_APP applications script that will spawn apps non stop.
170 .
/$TESTDIR/stress
/$LAUNCH_APP $NR_APP &
171 APPS_PID
="${APPS_PID} ${!}"
175 if [ $out -ne 0 ]; then
182 rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD