Tests: Rename helper functions to have consistent names
[lttng-tools.git] / tests / ust / multi-session / run
CommitLineData
00eb21af
DG
1#!/bin/bash
2#
3# Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
4#
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.
8#
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
12# details.
13#
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
c38b5107 17TEST_DESC="UST tracer - Multi-session"
00eb21af
DG
18
19CURDIR=$(dirname $0)/
20TESTDIR=$CURDIR/../..
21NR_ITER=100
22SESSION_NAME="multi-session"
23EVENT_NAME="ust_gen_nevents:tptest"
24
25source $TESTDIR/utils.sh
26
c38b5107 27print_test_banner "$TEST_DESC"
00eb21af
DG
28
29if [ ! -x "$CURDIR/gen-nevents" ]; then
30 echo -e "No UST nevents binary detected. Passing."
31 exit 0
32fi
33
34# MUST set TESTDIR before calling those functions
35
36test_multi_session() {
37 local out
38
39 # BEFORE application is spawned
40 for i in `seq 0 3`; do
41 create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i"
42 enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i"
fb3268e3 43 start_lttng_tracing "$SESSION_NAME-$i"
00eb21af
DG
44 done
45
46 echo -n "Starting application generating $NR_ITER events... "
47 ./$CURDIR/gen-nevents $NR_ITER &
c38b5107 48 print_ok
00eb21af
DG
49
50 # At least hit one event
51 echo -n "Waiting for events to record "
52 while [ -n "$(pidof gen-nevents)" ]; do
53 echo -n "."
54 sleep 0.1
55 done
c38b5107 56 print_ok
00eb21af
DG
57
58 for i in `seq 0 3`; do
fb3268e3 59 stop_lttng_tracing "$SESSION_NAME-$i"
00eb21af
DG
60 destroy_lttng_session "$SESSION_NAME-$i"
61 out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l)
62 if [ $out -ne $NR_ITER ]; then
63 echo -n "No event found. Suppose to have at least one... "
c38b5107 64 print_fail
00eb21af
DG
65 out=1
66 else
67 echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... "
c38b5107 68 print_ok
00eb21af
DG
69 out=0
70 fi
71 done
72
73 return $out
74}
75
76# MUST set TESTDIR before calling those functions
77
fb3268e3 78start_lttng_sessiond
00eb21af
DG
79
80TRACE_PATH=$(mktemp -d)
81
82test_multi_session
83out=$?
84if [ $out -ne 0 ]; then
fb3268e3 85 stop_lttng_sessiond
00eb21af
DG
86 exit $out
87fi
88
fb3268e3 89stop_lttng_sessiond
00eb21af
DG
90
91rm -rf "$TRACE_PATH"
This page took 0.026226 seconds and 4 git commands to generate.