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
)
27 TEST_DESC
="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps"
29 source $TESTDIR/utils
/utils.sh
31 # MUST set TESTDIR before calling those functions
33 function enable_channel_per_uid
()
38 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
--buffers-uid -u $channel_name -s $sess_name >/dev
/null
2>&1
39 ok $?
"Enable channel $channel_name per UID for session $sess_name"
42 function lttng_create_session_uri
46 # Create session with default path
47 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$name -U net
://localhost
>/dev
/null
2>&1
48 ok $?
"Create session on net://localhost"
51 function check_sessiond
()
53 if [ -z "$(pidof lt-lttng-sessiond)" ]; then
54 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
56 diag
"!!!The session daemon died unexpectedly!!!"
57 mv $LOG_FILE_SESSIOND $LOG_FILE_SESSIOND-$str_date
58 if [ -e $COREDUMP_FILE ]; then
59 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
65 function check_relayd
()
67 if [ -z "$(pidof lt-lttng-relayd)" ]; then
68 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
70 diag
"!!!The relay daemon died unexpectedly!!!"
71 mv $LOG_FILE_RELAYD $LOG_FILE_RELAYD-$str_date
72 if [ -e $COREDUMP_FILE ]; then
73 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
79 function start_sessiond
()
81 local SESSIOND_BIN
="lttng-sessiond"
83 validate_kernel_version
85 fail
"Start session daemon"
86 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
89 if [ -z $
(pidof lt-
$SESSIOND_BIN) ]; then
90 # We have to start it like this so the ulimit -c is used by this
91 # process. Also, we collect any error message printed out.
92 $TESTDIR/..
/src
/bin
/lttng-sessiond
/$SESSIOND_BIN --quiet --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
94 # Wait for sessiond to bootstrap
96 ok
$status "Start session daemon"
100 function start_relayd
103 local RELAYD_BIN
="lttng-relayd"
105 if [ -z $
(pidof lt-
$RELAYD_BIN) ]; then
106 $TESTDIR/..
/src
/bin
/lttng-relayd
/$RELAYD_BIN $opt >$LOG_FILE_RELAYD 2>&1 &
107 ok $?
"Start lttng-relayd (opt: \"$opt\")"
113 for b
in $
(seq 1 $NR_LOOP); do
114 for a
in $
(seq 1 $NR_SESSION); do
115 lttng_create_session_uri
$SESSION_NAME-$a
118 enable_channel_per_uid
$SESSION_NAME-$a $CHANNEL_NAME
121 enable_ust_lttng_event
$SESSION_NAME-$a $EVENT_NAME
124 start_lttng_tracing
$SESSION_NAME-$a
129 for a
in $
(seq 1 $NR_SESSION); do
130 stop_lttng_tracing
$SESSION_NAME-$a
133 destroy_lttng_session
$SESSION_NAME-$a
145 killall
-9 $LAUNCH_APP
150 function sighandler
()
153 rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
157 trap sighandler SIGINT
159 # Make sure we collect a coredump if possible.
162 # MUST set TESTDIR before calling those functions
163 plan_tests
$NUM_TESTS
165 print_test_banner
"$TEST_DESC"
167 TRACE_PATH
=$
(mktemp
-d)
169 start_relayd
"-o $TRACE_PATH"
172 diag
"Starting applications launcher"
174 # Start NR_APP applications script that will spawn apps non stop.
175 .
/$TESTDIR/stress
/$LAUNCH_APP $NR_APP &
179 if [ $out -ne 0 ]; then
186 rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
This page took 0.042002 seconds and 4 git commands to generate.