3 # Copyright (C) - 2012 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.
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
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
18 TEST_DESC
="UST tracer - Generate $NUM_PROCESS process"
21 TESTDIR
=$CURDIR/..
/..
/..
22 NR_ITER
=-1 # infinite loop
24 TESTAPP_PATH
="$TESTDIR/utils/testapp"
25 TESTAPP_NAME
="gen-ust-events"
26 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
27 SESSION_NAME
="ust-nprocesses"
28 EVENT_NAME
="tp:tptest"
33 source $TESTDIR/utils
/utils.sh
35 if [ ! -x "$TESTAPP_BIN" ]; then
36 BAIL_OUT
"No UST $TESTAPP_BIN binary detected."
39 # MUST set TESTDIR before calling those functions
43 print_test_banner
"$TEST_DESC"
47 # Start tests. Each is an infinite tracing loop.
49 file_sync_after_first
=$
(mktemp
-u)
50 file_sync_before_last
=$
(mktemp
-u)
52 diag
"Starting $NUM_PROCESS test applications"
53 for i
in `seq 1 $NUM_PROCESS`
55 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} >/dev
/null
2>&1 &
56 APPS_PID
="${APPS_PID} ${!}"
59 diag
"Waiting for applications to be registered to sessiond"
62 while [ $reg_app_count -ne $NUM_PROCESS ]; do
63 listing
=$
($TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN list
-u)
64 reg_app_count
=$
(echo -n $listing |
sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" |
grep "$TESTAPP_BIN" |
wc -l)
67 pass
"All applications are registered to sessiond"
69 TRACE_PATH
=$
(mktemp
-d)
71 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
73 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME
74 start_lttng_tracing_ok
$SESSION_NAME
76 touch ${file_sync_before_last}
78 # We don't validate whether the applications have traced here, rather
79 # just that they registered to sessiond (above).
81 stop_lttng_tracing_ok
$SESSION_NAME
82 destroy_lttng_session
$SESSION_NAME
84 #TODO: add trace validation.
88 diag
"Stopping all spawned applications"
89 for p
in ${APPS_PID}; do
94 pass
"Stopped all spawned applications"
96 rm -f ${file_sync_after_first}
97 rm -f ${file_sync_before_last}