Refactor: test: wrapper for stop_lttng_tracing
[lttng-tools.git] / tests / regression / ust / java-log4j / test_java_log4j
CommitLineData
504d4ace
DG
1#!/bin/bash
2#
3# Copyright (C) - 2014 David Goulet <dgoulet@efficios.com>
4#
5# This program is free software; you can redistribute it and/or modify it under
6# the terms of the GNU General Public License, version 2 only, as published by
7# 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 FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12# 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="Java LOG4J support"
19
20CURDIR=$(dirname $0)/
21TESTDIR=$CURDIR/../../..
22NR_ITER=6
23NR_MSEC_WAIT=1000
24TESTAPP_NAME="JTestLTTng"
25TESTAPP_BIN="$TESTAPP_NAME.java"
26TESTAPP_PATH="$CURDIR/$TESTAPP_NAME"
27SESSION_NAME="log4j"
28EVENT_NAME="log4j-event"
29EVENT_NAME2="log4j-event-2"
30JAVA_CP="$CURDIR:/usr/local/share/java/liblttng-ust-agent.jar:/usr/share/java/*"
31OUTPUT_DEST="/dev/null"
32
33NUM_TESTS=155
34
35source $TESTDIR/utils/utils.sh
36
37function run_app
38{
39 local debug_tp=$1
40 local fire_second_tp=$2
41
5fcaccbc 42 # FIXME: test app should have synchro.
504d4ace
DG
43 java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $debug_tp $fire_second_tp >/dev/null 2>&1
44}
45
46function run_app_background
47{
48 run_app $@ &
49}
50
51function enable_log4j_loglevel_only()
52{
53 sess_name=$1
54 event_name="$2"
55 loglevel=$3
56 channel_name=$4
57
58 if [ -z $channel_name ]; then
59 # default channel if none specified
60 chan=""
61 else
62 chan="-c $channel_name"
63 fi
64
65 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event --loglevel-only $loglevel "$event_name" $chan -s $sess_name -l >/dev/null 2>&1
66 ok $? "Enable LOG4J event $event_name for session $sess_name with loglevel-only $loglevel"
67}
68
69function enable_log4j_filter()
70{
71 local sess_name="$1"
72 local event_name="$2"
73 local filter="$3"
74
75 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -l --filter "$filter" >/dev/null 2>&1
76 ok $? "Enable event $event_name with filter $filter for session $sess_name"
77}
78
79function enable_log4j_filter_loglevel_only()
80{
81 local sess_name="$1"
82 local event_name="$2"
83 local filter="$3"
84 local loglevel="$4"
85
86 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event --loglevel-only $loglevel "$event_name" -s $sess_name -l --filter "$filter" >/dev/null 2>&1
87 ok $? "Enable event $event_name with filter \"$filter\" and loglevel-only $loglevel for session $sess_name"
88}
89
90# MUST set TESTDIR before calling those functions
91
92function test_log4j_before_start ()
93{
5fcaccbc
MD
94 local file_sync_after_first=$(mktemp -u)
95 local file_sync_before_last=$(mktemp -u)
96
504d4ace 97 diag "Test LOG4J application BEFORE tracing starts"
bf6ae429 98 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace
DG
99 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
100
101 # Run 5 times with a 1 second delay
102 run_app_background
103
e563bbdb 104 start_lttng_tracing_ok $SESSION_NAME
504d4ace 105
5fcaccbc
MD
106 touch ${file_sync_before_last}
107
504d4ace 108 # Wait for the applications started in background
0fc2834c 109 wait
504d4ace 110
96340a01 111 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
112 destroy_lttng_session $SESSION_NAME
113
5fcaccbc
MD
114 rm -f ${file_sync_after_first}
115 rm -f ${file_sync_before_last}
116
504d4ace
DG
117 # Validate test. Expecting all events.
118 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
119 if [ $? -ne 0 ]; then
120 return $?
121 fi
122}
123
124function test_log4j_after_start ()
125{
126 diag "Test LOG4J application AFTER tracing starts"
127
bf6ae429 128 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace 129 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
e563bbdb 130 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
131
132 # Run 5 times with a 1 second delay
133 run_app
134
96340a01 135 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
136 destroy_lttng_session $SESSION_NAME
137
138 # Validate test. Expecting all events.
139 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
140 if [ $? -ne 0 ]; then
141 return $?
142 fi
143}
144
145function test_log4j_loglevel ()
146{
147 diag "Test LOG4J application with loglevel"
148
bf6ae429 149 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace 150 enable_log4j_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "LOG4J_INFO"
e563bbdb 151 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
152
153 # Run 5 times with a 1 second delay
154 run_app
155
96340a01 156 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
157 destroy_lttng_session $SESSION_NAME
158
159 # Validate test. Expecting all events.
160 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
161 if [ $? -ne 0 ]; then
162 return $?
163 fi
164
165 diag "Test LOG4J applications with lower loglevel"
166
bf6ae429 167 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace 168 enable_log4j_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "LOG4J_FATAL"
e563bbdb 169 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
170
171 # Run 5 times with a 1 second delay
172 run_app
173
96340a01 174 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
175 destroy_lttng_session $SESSION_NAME
176
177 # Validate test. Expecting 0 events.
178 trace_match_only $EVENT_NAME 0 $TRACE_PATH
179 if [ $? -ne 0 ]; then
180 return $?
181 fi
182
183 diag "Test LOG4J applications with higher loglevel"
184
bf6ae429 185 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace 186 enable_log4j_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "LOG4J_TRACE"
e563bbdb 187 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
188
189 # Run 5 times with a 1 second delay
190 run_app
191
96340a01 192 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
193 destroy_lttng_session $SESSION_NAME
194
195 # Validate test. Expecting all events.
196 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
197 return $?
198}
199
200function test_log4j_loglevel_multiple ()
201{
202 diag "Test LOG4J application with multiple loglevel"
203
bf6ae429 204 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace
DG
205 enable_log4j_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "LOG4J_INFO"
206 enable_log4j_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "LOG4J_DEBUG"
e563bbdb 207 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
208
209 # Run 5 times with a 1 second delay and fire two TP.
210 run_app 1
211
96340a01 212 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
213 destroy_lttng_session $SESSION_NAME
214
215 # Validate test. Expecting all events times two.
216 trace_match_only $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
217 if [ $? -ne 0 ]; then
218 return $?
219 fi
220
bf6ae429 221 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
504d4ace
DG
222 enable_log4j_lttng_event_loglevel $SESSION_NAME '*' "LOG4J_INFO"
223 enable_log4j_lttng_event_loglevel $SESSION_NAME '*' "LOG4J_DEBUG"
e563bbdb 224 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
225
226 # Run 5 times with a 1 second delay and fire two TP.
227 run_app 1
228
96340a01 229 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
230 destroy_lttng_session $SESSION_NAME
231
232 # Validate test. Expecting all events times two.
233 trace_match_only $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
234 if [ $? -ne 0 ]; then
235 return $?
236 fi
237}
238
239function test_log4j_multi_session_loglevel()
240{
241 diag "Test LOG4J with multiple session"
242
bf6ae429 243 create_lttng_session_ok $SESSION_NAME-1 $TRACE_PATH/$SESSION_NAME-1
504d4ace 244 enable_log4j_loglevel_only $SESSION_NAME-1 '*' "LOG4J_INFO"
e563bbdb 245 start_lttng_tracing_ok $SESSION_NAME-1
504d4ace 246
bf6ae429 247 create_lttng_session_ok $SESSION_NAME-2 $TRACE_PATH/$SESSION_NAME-2
504d4ace 248 enable_log4j_loglevel_only $SESSION_NAME-2 '*' "LOG4J_DEBUG"
e563bbdb 249 start_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
250
251 # Run 5 times with a 1 second delay and fire second TP.
252 run_app 1 1
253
96340a01
JR
254 stop_lttng_tracing_ok $SESSION_NAME-1
255 stop_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
256 destroy_lttng_session $SESSION_NAME-1
257 destroy_lttng_session $SESSION_NAME-2
258
259 # Expecting 6 events being the main event plus the second tp.
260 trace_match_only $EVENT_NAME $(($NR_ITER + 1)) $TRACE_PATH/$SESSION_NAME-1
261 if [ $? -ne 0 ]; then
262 return $?
263 fi
264
265 # Expectin 5 events being the debug TP.
266 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME-2
267 if [ $? -ne 0 ]; then
268 return $?
269 fi
270}
271
272function test_log4j_multi_session_disable()
273{
274 diag "Test LOG4J with multiple session with disabled event"
275
bf6ae429 276 create_lttng_session_ok $SESSION_NAME-1 $TRACE_PATH/$SESSION_NAME-1
504d4ace
DG
277 enable_log4j_lttng_event $SESSION_NAME-1 $EVENT_NAME
278 enable_log4j_lttng_event $SESSION_NAME-1 $EVENT_NAME2
279 disable_log4j_lttng_event $SESSION_NAME-1 $EVENT_NAME
e563bbdb 280 start_lttng_tracing_ok $SESSION_NAME-1
504d4ace 281
bf6ae429 282 create_lttng_session_ok $SESSION_NAME-2 $TRACE_PATH/$SESSION_NAME-2
504d4ace 283 enable_log4j_lttng_event $SESSION_NAME-2 $EVENT_NAME2
e563bbdb 284 start_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
285
286 # Run 5 times with a 1 second delay and fire second TP.
287 run_app 0 1
288
96340a01
JR
289 stop_lttng_tracing_ok $SESSION_NAME-1
290 stop_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
291 destroy_lttng_session $SESSION_NAME-1
292 destroy_lttng_session $SESSION_NAME-2
293
294 # Validate test. Expecting one event of the second TP.
295 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-1
296 if [ $? -ne 0 ]; then
297 return $?
298 fi
299
300 # Validate test. Expecting one event of the second TP.
301 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2
302 if [ $? -ne 0 ]; then
303 return $?
304 fi
305}
306
307function test_log4j_multi_session_disable_wildcard()
308{
309 diag "Test LOG4J with multiple session with disabled wildcard event"
310
bf6ae429 311 create_lttng_session_ok $SESSION_NAME-1 $TRACE_PATH/$SESSION_NAME-1
504d4ace
DG
312 enable_log4j_lttng_event $SESSION_NAME-1 '*'
313
bf6ae429 314 create_lttng_session_ok $SESSION_NAME-2 $TRACE_PATH/$SESSION_NAME-2
504d4ace
DG
315 enable_log4j_lttng_event $SESSION_NAME-2 '*'
316
317 disable_log4j_lttng_event $SESSION_NAME-1 '*'
318
e563bbdb
JR
319 start_lttng_tracing_ok $SESSION_NAME-1
320 start_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
321
322 run_app
323
96340a01
JR
324 stop_lttng_tracing_ok $SESSION_NAME-1
325 stop_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
326 destroy_lttng_session $SESSION_NAME-1
327 destroy_lttng_session $SESSION_NAME-2
328
329 # Validate test. Expecting NO event of the first TP.
330 trace_match_only $EVENT_NAME 0 $TRACE_PATH/$SESSION_NAME-1
331 if [ $? -ne 0 ]; then
332 return $?
333 fi
334
335 # Validate test. Expecting all events of the first TP.
336 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME-2
337 if [ $? -ne 0 ]; then
338 return $?
339 fi
340}
341
342function test_log4j_disable_all()
343{
344 diag "Test LOG4J with multiple session with disabled all event"
345
bf6ae429 346 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
347 enable_log4j_lttng_event $SESSION_NAME '*'
348 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
349 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME2
350
351 disable_log4j_lttng_event $SESSION_NAME '*'
352
e563bbdb 353 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
354
355 run_app 0 1
356
96340a01 357 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
358 destroy_lttng_session $SESSION_NAME
359
360 # Validate test. Expecting NO event of the first TP and second TP.
361 trace_match_only $EVENT_NAME 0 $TRACE_PATH/$SESSION_NAME
362 trace_match_only $EVENT_NAME2 0 $TRACE_PATH/$SESSION_NAME
363 if [ $? -ne 0 ]; then
364 return $?
365 fi
366}
367
368function test_log4j_multi_session()
369{
370 diag "Test LOG4J with multiple session"
371
bf6ae429 372 create_lttng_session_ok $SESSION_NAME-1 $TRACE_PATH/$SESSION_NAME-1
504d4ace 373 enable_log4j_lttng_event $SESSION_NAME-1 $EVENT_NAME
e563bbdb 374 start_lttng_tracing_ok $SESSION_NAME-1
504d4ace 375
bf6ae429 376 create_lttng_session_ok $SESSION_NAME-2 $TRACE_PATH/$SESSION_NAME-2
504d4ace 377 enable_log4j_lttng_event $SESSION_NAME-2 $EVENT_NAME2
e563bbdb 378 start_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
379
380 # Run 5 times with a 1 second delay and fire second TP.
381 run_app 0 1
382
96340a01
JR
383 stop_lttng_tracing_ok $SESSION_NAME-1
384 stop_lttng_tracing_ok $SESSION_NAME-2
504d4ace
DG
385 destroy_lttng_session $SESSION_NAME-1
386 destroy_lttng_session $SESSION_NAME-2
387
388 # Validate test. Expecting all events of first TP
389 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME-1
390 if [ $? -ne 0 ]; then
391 return $?
392 fi
393
394 # Validate test. Expecting one event of the second TP.
395 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2
396 if [ $? -ne 0 ]; then
397 return $?
398 fi
399}
400
401function test_log4j_destroy_session()
402{
403 diag "Test LOG4J two session with destroy"
404
bf6ae429 405 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/first-sess
504d4ace 406 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
e563bbdb 407 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
408
409 # Run 5 times with a 1 second delay
410 run_app_background 0 1
0fc2834c
MD
411 # Wait for the applications started in background
412 wait
504d4ace 413
96340a01 414 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
415 destroy_lttng_session $SESSION_NAME
416
417 # Validate test. Expecting at least one event num 1
418 validate_trace $EVENT_NAME $TRACE_PATH/first-sess
419 if [ $? -ne 0 ]; then
420 return $?
421 fi
422
bf6ae429 423 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/second-sess
504d4ace 424 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME2
e563bbdb 425 start_lttng_tracing_ok $SESSION_NAME
504d4ace 426
0fc2834c
MD
427 # Run 5 times with a 1 second delay
428 run_app_background 0 1
504d4ace 429 # Wait for the applications started in background
0fc2834c 430 wait
504d4ace 431
96340a01 432 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
433 destroy_lttng_session $SESSION_NAME
434
435 # Validate test. Expecting only one event num 2
436 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/second-sess
437 if [ $? -ne 0 ]; then
438 return $?
439 fi
440}
441
442function test_log4j_filtering()
443{
444 diag "Test LOG4J filtering"
445
bf6ae429 446 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
447 # Enable all event with a filter.
448 enable_log4j_filter $SESSION_NAME '*' 'msg == "LOG4J second logger fired"'
e563bbdb 449 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
450
451 # Run 5 times with a 1 second delay and fire second TP.
452 run_app 0 1
453
96340a01 454 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
455 destroy_lttng_session $SESSION_NAME
456
457 # Validate test. Expecting one event of the second TP only.
458 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME
459 if [ $? -ne 0 ]; then
460 return $?
461 fi
462
bf6ae429 463 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
464 # Enable first Logger but filter msg payload for the INFO one while
465 # triggering the debug and second TP.
466 enable_log4j_filter $SESSION_NAME $EVENT_NAME 'msg == "LOG4J tp fired!"'
e563bbdb 467 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
468
469 # Run 5 times with a 1 second delay, fire debug and second TP.
470 run_app 1 1
471
96340a01 472 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
473 destroy_lttng_session $SESSION_NAME
474
475 # Validate test. Expecting NR_ITER event of the main INFO tp.
476 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME
477 if [ $? -ne 0 ]; then
478 return $?
479 fi
480}
481
482function test_log4j_disable()
483{
484 diag "Test LOG4J disable event"
485
bf6ae429 486 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
487 # Enable all event with a filter.
488 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
489 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME2
490 disable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
e563bbdb 491 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
492
493 # Run 5 times with a 1 second delay and fire second TP.
494 run_app 0 1
495
96340a01 496 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
497 destroy_lttng_session $SESSION_NAME
498
499 # Validate test. Expecting one event of the second TP only.
500 trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME
501 if [ $? -ne 0 ]; then
502 return $?
503 fi
504}
505
506function test_log4j_disable_enable()
507{
508 diag "Test LOG4J disable event followed by an enable"
509
bf6ae429 510 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
511 # Enable all event with a filter.
512 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
513 disable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
514 enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
e563bbdb 515 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
516
517 # Run 5 times with a 1 second delay and fire second TP.
518 run_app 0 1
519
96340a01 520 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
521 destroy_lttng_session $SESSION_NAME
522
523 # Validate test. Expecting NR_ITER event of the main INFO tp.
524 trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME
525 if [ $? -ne 0 ]; then
526 return $?
527 fi
528}
529
530function test_log4j_filter_loglevel()
531{
532 local BOGUS_EVENT_NAME="not_a_real_event"
533 local FILTER="int_loglevel > 700 || int_loglevel < 700"
534 local ALL_EVENTS="."
535
536 diag "Test LOG4J a filter with a loglevel"
537
bf6ae429 538 create_lttng_session_ok $SESSION_NAME $TRACE_PATH/$SESSION_NAME
504d4ace
DG
539 # Enable an event with a filter and the loglevel-only option.
540 enable_log4j_filter_loglevel_only $SESSION_NAME $BOGUS_EVENT_NAME "$FILTER" LOG4J_INFO
541 disable_log4j_lttng_event $SESSION_NAME $BOGUS_EVENT_NAME
542 enable_log4j_filter_loglevel_only $SESSION_NAME $BOGUS_EVENT_NAME "$FILTER" LOG4J_INFO
e563bbdb 543 start_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
544
545 # Run 5 times with a 1 second delay and fire second TP.
546 run_app 0 1
547
96340a01 548 stop_lttng_tracing_ok $SESSION_NAME
504d4ace
DG
549 destroy_lttng_session $SESSION_NAME
550
551 # Validate test. Expecting no events.
552 trace_match_only $ALL_EVENTS 0 $TRACE_PATH/$SESSION_NAME
553 if [ $? -ne 0 ]; then
554 return $?
555 fi
556}
557
558plan_tests $NUM_TESTS
559
560print_test_banner "$TEST_DESC"
561
562if [ ! -f "$TESTAPP_PATH.class" ]; then
563 withapp=0
564else
565 withapp=1
566fi
567
568skip $withapp "LOG4J support is needed. Skipping all tests." $NUM_TESTS ||
569{
570 start_lttng_sessiond
571
572 tests=(
573 test_log4j_multi_session_disable_wildcard
574 test_log4j_multi_session_disable
575 test_log4j_disable
576 test_log4j_disable_enable
577 test_log4j_disable_all
578 test_log4j_filtering
579 test_log4j_multi_session_loglevel
580 test_log4j_destroy_session
581 test_log4j_loglevel
582 test_log4j_loglevel_multiple
583 test_log4j_before_start
584 test_log4j_after_start
585 test_log4j_multi_session
586 test_log4j_filter_loglevel
587 )
588
589 for fct_test in ${tests[@]};
590 do
591 TRACE_PATH=$(mktemp -d)
592
593 ${fct_test}
594 if [ $? -ne 0 ]; then
595 break;
596 fi
597 rm -rf $TRACE_PATH
598 done
599
600 stop_lttng_sessiond
601}
This page took 0.078164 seconds and 4 git commands to generate.