Fix: Don't leave events enabled if they were saved in a disabled state
[lttng-tools.git] / tests / regression / tools / save-load / test_load
CommitLineData
e02b109b
DG
1#!/bin/bash
2#
3# Copyright (C) - 2014 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
18TEST_DESC="Load session(s)"
19
20CURDIR=$(dirname $0)/
21TESTDIR=$CURDIR/../../../
22SESSIOND_BIN="lttng-sessiond"
23RELAYD_BIN="lttng-relayd"
24LTTNG_BIN="lttng"
742e5f18 25export LTTNG_SESSION_CONFIG_XSD_PATH=$(readlink -m ${TESTDIR}../src/common/config/)
e02b109b
DG
26
27SESSION_NAME="load-42"
28EVENT_NAME="tp:tptest"
29
30DIR=$(readlink -f $TESTDIR)
31
32NUM_TESTS=20
33
34source $TESTDIR/utils/utils.sh
35
36# MUST set TESTDIR before calling those functions
37plan_tests $NUM_TESTS
38
39print_test_banner "$TEST_DESC"
40
41function disable_event()
42{
43 local sess_name="$1"
44 local chan_name="$2"
45 local event_name="$3"
46
47 $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -c $chan_name -u >/dev/null 2>&1
48 ok $? "Disable event $event_name for session $sess_name"
49}
50
51function test_basic_load()
52{
53 diag "Test basic load"
54
83b7c3bf 55 lttng_load "-i $CURDIR/$SESSION_NAME.lttng"
e02b109b
DG
56
57 destroy_lttng_session $SESSION_NAME
58}
59
60function test_complex_load()
61{
62 local sess="$SESSION_NAME-complex"
63 diag "Test complex load"
64
65 # Start relayd with localhost binding. The complex session uses those
66 # custom values.
67 start_lttng_relayd "-C tcp://localhost:8172 -D tcp://localhost:9817"
68
83b7c3bf 69 lttng_load "-i $CURDIR/$sess.lttng"
e02b109b
DG
70
71 # Once loaded, we are suppose to be able to disable certain events/channels
72 # thus having a confirmation that it's valid
73 disable_event $sess chan1 uevent1
74 disable_event $sess chan2 uevent2
75 disable_event $sess chan3 uevent3*
76
77 disable_ust_lttng_channel $sess chan1
78 disable_ust_lttng_channel $sess chan2
79 disable_ust_lttng_channel $sess chan3
80
81 destroy_lttng_session $sess
82
83 stop_lttng_relayd_nocheck
84}
85
86function test_all_load()
87{
88 diag "Test load all sessions"
89
90 # Start relayd with localhost binding. The complex session uses those
91 # custom values.
92 start_lttng_relayd "-C tcp://localhost:8172 -D tcp://localhost:9817"
93
94 lttng_load "-a -i $CURDIR"
95
96 destroy_lttng_session $SESSION_NAME
97 destroy_lttng_session "$SESSION_NAME-complex"
98
99 stop_lttng_relayd_nocheck
100}
101
102function test_overwrite()
103{
104 diag "Test load overwrite"
105
83b7c3bf 106 lttng_load "-i $CURDIR/$SESSION_NAME.lttng"
e02b109b
DG
107
108 # This one should succeed
11143783 109 lttng_load "-f -i $CURDIR $SESSION_NAME"
e02b109b
DG
110
111 destroy_lttng_session $SESSION_NAME
112}
113
114start_lttng_sessiond
115
116TESTS=(
117 test_basic_load
118 test_complex_load
119 test_all_load
120 test_overwrite
121)
122
123for fct_test in ${TESTS[@]};
124do
125 TRACE_PATH=$(mktemp -d)
126
127 ${fct_test}
128 if [ $? -ne 0 ]; then
129 break;
130 fi
131 # Only delete if successful
132 rm -rf $TRACE_PATH
133done
134
135stop_lttng_sessiond
This page took 0.027795 seconds and 4 git commands to generate.