3 # Copyright (C) - 2014 David Goulet <dgoulet@efficios.com>
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.
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
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
18 TEST_DESC
="Save session(s)"
21 TESTDIR
=$CURDIR/..
/..
/..
/
22 SESSIOND_BIN
="lttng-sessiond"
23 RELAYD_BIN
="lttng-relayd"
26 SESSION_NAME
="save-42"
27 CHANNEL_NAME
="chan-save"
28 EVENT_NAME
="tp:tptest"
30 DIR
=$
(readlink
-f $TESTDIR)
34 source $TESTDIR/utils
/utils.sh
36 # MUST set TESTDIR before calling those functions
39 print_test_banner
"$TEST_DESC"
42 function save_lttng_fail
()
47 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN save
$sess_name $opts >/dev
/null
2>&1
49 ok
0 "Session failed to be saved. Expected!"
51 ok
1 "Session has been saved. NOT expected!"
55 function is_session_saved
()
60 [ -f "$path/$name.lttng" ];
61 ok $?
"Session $name.lttng file found!"
64 function test_basic_save
()
66 diag
"Test basic save"
68 create_lttng_session
$SESSION_NAME $TRACE_PATH
69 enable_ust_lttng_channel
$SESSION_NAME $CHANNEL_NAME
70 enable_ust_lttng_event
$SESSION_NAME $EVENT_NAME $CHANNEL_NAME
72 lttng_save
$SESSION_NAME "-o $TRACE_PATH"
74 is_session_saved
$TRACE_PATH $SESSION_NAME
76 destroy_lttng_session
$SESSION_NAME
79 function test_basic_save_all
()
81 diag
"Test basic save all"
83 create_lttng_session
$SESSION_NAME-1 $TRACE_PATH
84 create_lttng_session
$SESSION_NAME-2 $TRACE_PATH
85 create_lttng_session
$SESSION_NAME-3 $TRACE_PATH
87 enable_ust_lttng_channel
$SESSION_NAME-1 $CHANNEL_NAME
88 enable_ust_lttng_channel
$SESSION_NAME-2 $CHANNEL_NAME
89 enable_ust_lttng_channel
$SESSION_NAME-3 $CHANNEL_NAME
91 enable_ust_lttng_event
$SESSION_NAME-1 $EVENT_NAME $CHANNEL_NAME
92 enable_ust_lttng_event
$SESSION_NAME-2 $EVENT_NAME $CHANNEL_NAME
93 enable_ust_lttng_event
$SESSION_NAME-3 $EVENT_NAME $CHANNEL_NAME
95 lttng_save
"" "-a -o $TRACE_PATH"
97 is_session_saved
$TRACE_PATH $SESSION_NAME-1
98 is_session_saved
$TRACE_PATH $SESSION_NAME-2
99 is_session_saved
$TRACE_PATH $SESSION_NAME-3
101 destroy_lttng_session
$SESSION_NAME-1
102 destroy_lttng_session
$SESSION_NAME-2
103 destroy_lttng_session
$SESSION_NAME-3
106 function test_overwrite
()
108 diag
"Test overwrite session file"
110 create_lttng_session
$SESSION_NAME $TRACE_PATH
111 enable_ust_lttng_channel
$SESSION_NAME $CHANNEL_NAME
112 enable_ust_lttng_event
$SESSION_NAME $EVENT_NAME $CHANNEL_NAME
114 lttng_save
$SESSION_NAME "-o $TRACE_PATH"
116 is_session_saved
$TRACE_PATH $SESSION_NAME
118 destroy_lttng_session
$SESSION_NAME
120 # Create a new session with same name so we can force the overwrite
121 create_lttng_session
$SESSION_NAME $TRACE_PATH
122 enable_ust_lttng_channel
$SESSION_NAME $CHANNEL_NAME
123 enable_ust_lttng_event
$SESSION_NAME $EVENT_NAME $CHANNEL_NAME
126 save_lttng_fail
$SESSION_NAME "-o $TRACE_PATH"
128 # This one MUST succeed
129 lttng_save
$SESSION_NAME "-f -o $TRACE_PATH"
131 is_session_saved
$TRACE_PATH $SESSION_NAME
133 destroy_lttng_session
$SESSION_NAME
144 for fct_test
in ${TESTS[@]};
146 TRACE_PATH
=$
(mktemp
-d)
149 if [ $?
-ne 0 ]; then
152 # Only delete if successful
This page took 0.032084 seconds and 4 git commands to generate.