3 # Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
5 # SPDX-License-Identifier: LGPL-2.1-only
10 LAUNCH_APP
="launch_ust_app"
12 EVENT_NAME
="tp:tptest"
13 LOG_FILE
="sessiond.log"
14 CHANNEL_NAME
="channel0"
19 COREDUMP_FILE
=$
(cat /proc
/sys
/kernel
/core_pattern
)
22 TEST_DESC
="Stress test - $NR_SESSION sessions per UID with $NR_APP apps"
24 source $TESTDIR/utils
/utils.sh
26 # MUST set TESTDIR before calling those functions
28 function enable_channel_per_uid
()
33 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
--buffers-uid -u $channel_name -s $sess_name >/dev
/null
2>&1
34 ok $?
"Enable channel $channel_name per UID for session $sess_name"
37 function check_sessiond
()
39 if [ -z "$(pgrep --full lt-lttng-sessiond)" ]; then
40 local str_date
=$
(date +%H
%M
%S-
%d
%m
%Y
)
42 diag
"!!!The session daemon died unexpectedly!!!"
43 mv $LOG_FILE $LOG_FILE-$str_date
44 if [ -e $COREDUMP_FILE ]; then
45 mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
51 function start_sessiond
()
53 validate_kernel_version
55 fail
"Start session daemon"
56 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
59 if [ -z $
(pgrep
--full lt-
$SESSIOND_BIN) ]; then
60 # We have to start it like this so the ulimit -c is used by this
61 # process. Also, we collect any error message printed out.
62 $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 2>&1
64 ok
$status "Start session daemon"
70 for b
in $
(seq 1 $NR_LOOP); do
71 for a
in $
(seq 1 $NR_SESSION); do
72 create_lttng_session_ok
$SESSION_NAME-$a $TRACE_PATH
74 enable_channel_per_uid
$SESSION_NAME-$a $CHANNEL_NAME
76 enable_ust_lttng_event_ok
$SESSION_NAME-$a $EVENT_NAME
78 start_lttng_tracing_ok
$SESSION_NAME-$a
82 for a
in $
(seq 1 $NR_SESSION); do
83 stop_lttng_tracing_ok
$SESSION_NAME-$a
85 destroy_lttng_session_ok
$SESSION_NAME-$a
96 for p
in ${APPS_PID}; do
104 function sighandler
()
111 trap sighandler SIGINT SIGTERM
113 # Make sure we collect a coredump if possible.
116 # MUST set TESTDIR before calling those functions
117 plan_tests
$NUM_TESTS
119 print_test_banner
"$TEST_DESC"
123 diag
"Starting applications"
125 # Start NR_APP applications script that will spawn apps non stop.
126 .
/$TESTDIR/stress
/$LAUNCH_APP $NR_APP &
127 APPS_PID
="${APPS_PID} ${!}"
129 TRACE_PATH
=$
(mktemp
-d)
133 if [ $out -ne 0 ]; then