Use the in-tree session.xsd in test_load
[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 export LTTNG_SESSION_CONFIG_XSD_PATH=${TESTDIR}../src/common/config/
26
27 SESSION_NAME="load-42"
28 EVENT_NAME="tp:tptest"
29
30 DIR=$(readlink -f $TESTDIR)
31
32 NUM_TESTS=20
33
34 source $TESTDIR/utils/utils.sh
35
36 # MUST set TESTDIR before calling those functions
37 plan_tests $NUM_TESTS
38
39 print_test_banner "$TEST_DESC"
40
41 function 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
51 function test_basic_load()
52 {
53 diag "Test basic load"
54
55 lttng_load "-i $CURDIR/$SESSION_NAME.lttng"
56
57 destroy_lttng_session $SESSION_NAME
58 }
59
60 function 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
69 lttng_load "-i $CURDIR/$sess.lttng"
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
86 function 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
102 function test_overwrite()
103 {
104 diag "Test load overwrite"
105
106 lttng_load "-i $CURDIR/$SESSION_NAME.lttng"
107
108 # This one should succeed
109 lttng_load "-f -i $CURDIR $SESSION_NAME"
110
111 destroy_lttng_session $SESSION_NAME
112 }
113
114 start_lttng_sessiond
115
116 TESTS=(
117 test_basic_load
118 test_complex_load
119 test_all_load
120 test_overwrite
121 )
122
123 for fct_test in ${TESTS[@]};
124 do
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
133 done
134
135 stop_lttng_sessiond
This page took 0.034475 seconds and 6 git commands to generate.