Tests: Fix first line of output to follow TAP guidelines
[lttng-tools.git] / tests / regression / ust / multi-session / test_multi_session
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
17 TEST_DESC="UST tracer - Multi-session"
18
19 CURDIR=$(dirname $0)/
20 TESTDIR=$CURDIR/../../..
21 NR_ITER=100
22 SESSION_NAME="multi-session"
23 EVENT_NAME="ust_gen_nevents:tptest"
24 NUM_TESTS=28
25
26 source $TESTDIR/utils/utils.sh
27
28 if [ ! -x "$CURDIR/gen-nevents" ]; then
29 BAIL_OUT "No UST nevents binary detected."
30 fi
31
32 # MUST set TESTDIR before calling those functions
33
34 test_multi_session() {
35 local out
36
37 # BEFORE application is spawned
38 for i in `seq 0 3`; do
39 create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i"
40 enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i"
41 start_lttng_tracing "$SESSION_NAME-$i"
42 done
43
44 ./$CURDIR/gen-nevents $NR_ITER &
45 ok $? "Start application to generate $NR_ITER events"
46
47 # At least hit one event
48 while [ -n "$(pidof gen-nevents)" ]; do
49 sleep 0.1
50 done
51
52 pass "Wait for events to record"
53
54 for i in `seq 0 3`; do
55 stop_lttng_tracing "$SESSION_NAME-$i"
56 destroy_lttng_session "$SESSION_NAME-$i"
57 out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l)
58 if [ $out -ne $NR_ITER ]; then
59 fail "Trace validation of $SESSION_NAME-$i"
60 diag "No events found."
61 out=1
62 break
63 else
64 pass "Trace validation of $SESSION_NAME-$i"
65 diag "Found $out event(s) for $SESSION_NAME-$i."
66 out=0
67 fi
68 done
69
70 return $out
71 }
72
73 # MUST set TESTDIR before calling those functions
74
75 plan_tests $NUM_TESTS
76
77 print_test_banner "$TEST_DESC"
78
79 start_lttng_sessiond
80
81 TRACE_PATH=$(mktemp -d)
82
83 test_multi_session
84 out=$?
85 if [ $out -ne 0 ]; then
86 stop_lttng_sessiond
87 exit $out
88 fi
89
90 stop_lttng_sessiond
91
92 rm -rf "$TRACE_PATH"
This page took 0.031334 seconds and 4 git commands to generate.