Tests: lttng-ust-getcpu-override-test cache and error-check sysconf()
[lttng-tools.git] / tests / regression / ust / test_event_basic
... / ...
CommitLineData
1#!/bin/bash
2#
3# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4#
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.
8#
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
12# more details.
13#
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.
17
18TEST_DESC="UST tracer - Basic events"
19
20CURDIR=$(dirname $0)/
21TESTDIR=$CURDIR/../..
22LTTNG_BIN="lttng"
23BIN_NAME="gen-ust-events"
24SESSION_NAME="valid_filter"
25EVENT_NAME="tp:tptest"
26NUM_TESTS=25
27
28source $TESTDIR/utils/utils.sh
29
30function enable_ust_lttng_event_per_chan()
31{
32 sess_name="$1"
33 event_name="$2"
34 chan_name="$3"
35
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"
38}
39
40function disable_ust_lttng_event_per_chan()
41{
42 sess_name="$1"
43 event_name="$2"
44 chan_name="$3"
45
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"
48}
49
50function add_ust_lttng_context()
51{
52 sess_name="$1"
53 chan_name="$2"
54 type="$3"
55
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"
58}
59
60function test_event_basic()
61{
62 TRACE_PATH=$(mktemp -d)
63 SESSION_NAME="ust_event_basic"
64 SESSION_NAME2="ust_event_basic2"
65 CHAN_NAME="mychan"
66 CHAN_NAME2="mychan2"
67 EVENT_NAME="tp1"
68 EVENT_NAME2="ev2"
69 EVENT_NAME3="ev3"
70
71 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
72 create_lttng_session_ok $SESSION_NAME2 $TRACE_PATH
73
74 enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME
75 enable_ust_lttng_channel_ok $SESSION_NAME2 $CHAN_NAME2
76
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
80
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"
86
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
89
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
92
93 start_lttng_tracing_ok
94 stop_lttng_tracing_ok
95
96 start_lttng_tracing_ok
97 stop_lttng_tracing_ok
98
99 TODO="Validate trace output is coherent"
100 ok 0 "Validate trace"
101 unset TODO
102
103 destroy_lttng_session_ok $SESSION_NAME2
104 destroy_lttng_session_ok $SESSION_NAME
105
106 rm -rf $TRACE_PATH
107}
108
109# MUST set TESTDIR before calling those functions
110plan_tests $NUM_TESTS
111
112print_test_banner "$TEST_DESC"
113
114start_lttng_sessiond
115
116test_event_basic
117
118stop_lttng_sessiond
This page took 0.022235 seconds and 4 git commands to generate.