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"
16 KILL_RELAYD_HELPER
="kill_relayd"
18 EVENT_NAME
="tp:tptest"
19 LOG_FILE_SESSIOND
="sessiond.log"
20 LOG_FILE_RELAYD
="relayd.log"
21 CHANNEL_NAME
="channel0"
25 COREDUMP_FILE
=$
(cat /proc
/sys
/kernel
/core_pattern
)
28 TEST_DESC
="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps. The relayd is killed sporadically"
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 lttng_create_session_uri
47 # Create session with default path
48 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$name -U net
://localhost
>/dev
/null
2>&1
49 ok $?
"Create session on net://localhost"
52 function check_sessiond
()
54 if [ -z "$(pidof lt-lttng-sessiond)" ]; then
55 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
57 diag
"!!!The session daemon died unexpectedly!!!"
58 mv $LOG_FILE_SESSIOND $LOG_FILE_SESSIOND-$str_date
59 if [ -e $COREDUMP_FILE ]; then
60 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
66 function start_sessiond
()
68 local SESSIOND_BIN
="lttng-sessiond"
70 validate_kernel_version
72 fail
"Start session daemon"
73 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
76 if [ -z $
(pidof lt-
$SESSIOND_BIN) ]; then
77 # We have to start it like this so the ulimit -c is used by this
78 # process. Also, we collect any error message printed out.
79 #$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 &
80 $TESTDIR/..
/src
/bin
/lttng-sessiond
/$SESSIOND_BIN --verbose-consumer -vvv --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
81 #$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1 &
83 # Wait for sessiond to bootstrap
85 ok
$status "Start session daemon"
92 local RELAYD_BIN
="lttng-relayd"
94 if [ -z $
(pidof lt-
$RELAYD_BIN) ]; then
95 $TESTDIR/..
/src
/bin
/lttng-relayd
/$RELAYD_BIN $opt >$LOG_FILE_RELAYD 2>&1 &
96 ok $?
"Start lttng-relayd (opt: \"$opt\")"
100 function check_relayd
()
102 if [ -z "$(pidof lt-lttng-relayd)" ]; then
103 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
105 #diag "Relay daemon died. Starting it again"
106 if [ -e $COREDUMP_FILE ]; then
107 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
115 for b
in $
(seq 1 $NR_LOOP); do
116 for a
in $
(seq 1 $NR_SESSION); do
117 lttng_create_session_uri
$SESSION_NAME-$a
120 enable_channel_per_uid
$SESSION_NAME-$a $CHANNEL_NAME
123 enable_ust_lttng_event
$SESSION_NAME-$a $EVENT_NAME
126 start_lttng_tracing
$SESSION_NAME-$a
131 for a
in $
(seq 1 $NR_SESSION); do
132 stop_lttng_tracing
$SESSION_NAME-$a
135 destroy_lttng_session
$SESSION_NAME-$a
147 killall
-9 $LAUNCH_APP
148 killall
-9 $KILL_RELAYD_HELPER
153 function sighandler
()
156 #rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
160 trap sighandler SIGINT
162 # Make sure we collect a coredump if possible.
165 # MUST set TESTDIR before calling those functions
166 plan_tests
$NUM_TESTS
168 print_test_banner
"$TEST_DESC"
170 TRACE_PATH
=$
(mktemp
-d)
172 start_relayd
"-o $TRACE_PATH"
175 diag
"Starting applications launcher"
177 # Start NR_APP applications script that will spawn apps non stop.
178 .
/$TESTDIR/stress
/$LAUNCH_APP $NR_APP &
179 # Launch the helper script that will randomly kill the relayd at vitam eternam.
180 .
/$TESTDIR/stress
/$KILL_RELAYD_HELPER 1 1 &
184 if [ $out -ne 0 ]; then
191 rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
This page took 0.036936 seconds and 4 git commands to generate.