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