Refactor: test: wrapper for create_lttng_session
[lttng-tools.git] / tests / regression / ust / test_event_tracef
CommitLineData
38150970
MD
1#!/bin/bash
2#
3# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4# Copyright (C) - 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5#
6# This program is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License, version 2 only, as
8# published by the Free Software Foundation.
9#
10# This program is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13# more details.
14#
15# You should have received a copy of the GNU General Public License along with
16# this program; if not, write to the Free Software Foundation, Inc., 51
17# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19TEST_DESC="UST tracer - tracef events"
20
21CURDIR=$(dirname $0)/
22TESTDIR=$CURDIR/../..
23LTTNG_BIN="lttng"
24TESTAPP_PATH="$TESTDIR/utils/testapp"
25TESTAPP_NAME="gen-ust-tracef"
26TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
27SESSION_NAME="tracef"
28EVENT_NAME="lttng_ust_tracef:event"
29NUM_TESTS=9
30NR_ITER=100
31
32source $TESTDIR/utils/utils.sh
33
34if [ ! -x "$TESTAPP_BIN" ]; then
35 BAIL_OUT "No UST nevents binary detected."
36fi
37
38function test_event_tracef()
39{
bf6ae429 40 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
38150970
MD
41 enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
42 start_lttng_tracing $SESSION_NAME
43
44 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
45 ok $? "Traced application stopped."
46
47 stop_lttng_tracing $SESSION_NAME
48 destroy_lttng_session $SESSION_NAME
49
d53addeb 50 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
38150970
MD
51
52 return $?
53}
54
55# MUST set TESTDIR before calling those functions
56plan_tests $NUM_TESTS
57
58print_test_banner "$TEST_DESC"
59
60start_lttng_sessiond
61
62TRACE_PATH=$(mktemp -d)
63test_event_tracef
64out=$?
65if [ $out -ne 0 ]; then
66 stop_lttng_sessiond
67 exit $out
68fi
69
70stop_lttng_sessiond
71
72rm -rf $TRACE_PATH
This page took 0.026235 seconds and 4 git commands to generate.