3 # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License, version 2 only, as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 TEST_DESC
="UST tracer - Basic events"
23 BIN_NAME
="gen-ust-events"
24 SESSION_NAME
="valid_filter"
25 EVENT_NAME
="tp:tptest"
28 source $TESTDIR/utils
/utils.sh
30 function enable_ust_lttng_event_per_chan
()
36 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -c $chan_name -u >/dev
/null
2>&1
37 ok $?
"Enable event $event_name for session $sess_name in channel $chan_name"
40 function disable_ust_lttng_event_per_chan
()
46 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -c $chan_name -u >/dev
/null
2>&1
47 ok $?
"Disable event $event_name for session $sess_name in channel $chan_name"
50 function add_ust_lttng_context
()
56 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN add-context
-s $sess_name -c $chan_name -t $type -u >/dev
/null
2>&1
57 ok $?
"Add context $type for session $sess_name in channel $chan_name"
60 function test_event_basic
()
62 TRACE_PATH
=$
(mktemp
-d)
63 SESSION_NAME
="ust_event_basic"
64 SESSION_NAME2
="ust_event_basic2"
71 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
72 create_lttng_session_ok
$SESSION_NAME2 $TRACE_PATH
74 enable_ust_lttng_channel_ok
$SESSION_NAME $CHAN_NAME
75 enable_ust_lttng_channel_ok
$SESSION_NAME2 $CHAN_NAME2
77 enable_ust_lttng_event_per_chan
$SESSION_NAME $EVENT_NAME $CHAN_NAME
78 enable_ust_lttng_event_per_chan
$SESSION_NAME $EVENT_NAME2 $CHAN_NAME
79 enable_ust_lttng_event_per_chan
$SESSION_NAME2 $EVENT_NAME3 $CHAN_NAME2
81 add_ust_lttng_context
$SESSION_NAME $CHAN_NAME "vpid"
82 add_ust_lttng_context
$SESSION_NAME $CHAN_NAME "vtid"
83 add_ust_lttng_context
$SESSION_NAME $CHAN_NAME "pthread_id"
84 add_ust_lttng_context
$SESSION_NAME $CHAN_NAME "procname"
85 add_ust_lttng_context
$SESSION_NAME2 $CHAN_NAME2 "procname"
87 disable_ust_lttng_event_per_chan
$SESSION_NAME $EVENT_NAME $CHAN_NAME
88 disable_ust_lttng_event_per_chan
$SESSION_NAME2 $EVENT_NAME3 $CHAN_NAME2
90 enable_ust_lttng_event_per_chan
$SESSION_NAME $EVENT_NAME $CHAN_NAME
91 enable_ust_lttng_event_per_chan
$SESSION_NAME2 $EVENT_NAME3 $CHAN_NAME2
99 TODO
="Validate trace output is coherent"
100 ok
0 "Validate trace"
103 destroy_lttng_session
$SESSION_NAME2
104 destroy_lttng_session
$SESSION_NAME
109 # MUST set TESTDIR before calling those functions
110 plan_tests
$NUM_TESTS
112 print_test_banner
"$TEST_DESC"