SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / tests / regression / kernel / test_syscall
CommitLineData
8cfcd41c
MD
1#!/bin/bash
2#
9d16b343
MJ
3# Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
4# Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8cfcd41c 5#
9d16b343 6# SPDX-License-Identifier: GPL-2.0-only
8cfcd41c 7#
8cfcd41c
MD
8
9TEST_DESC="Kernel tracer - System calls"
10
11CURDIR=$(dirname $0)/
12TESTDIR=$CURDIR/../..
c8e51d15 13NUM_TESTS=183
8cfcd41c 14
c8e51d15
FD
15# `gen-syscall-event` starts and waits for the creation a file passed by
16# arguments to start executing 3 syscalls (open,read,close) and returning.
17TESTCMD="$TESTDIR/utils/testapp/gen-syscall-events/gen-syscall-events"
8cfcd41c
MD
18
19source $TESTDIR/utils/utils.sh
20
c8e51d15
FD
21function trace_testapp()
22{
23 local start_file_sync
24 start_file_sync=$(mktemp -u)
25
26 # Clear all entries from the resource tracker
27 lttng_untrack_kernel_all_ok
28
29 # Launch the testapp and save its Process ID
2463b787 30 ./"$TESTCMD" "$start_file_sync" "/proc/cpuinfo" "/proc/cmdline" &
c8e51d15
FD
31 PID=$!
32
33 # Set LTTng to track this PID and start the tracing
34 lttng_track_pid_ok $PID
35
36 start_lttng_tracing_ok
37
38 # Create start file to launch the execution of the workload by the
39 # test app
40 touch "$start_file_sync"
41
42 wait $PID
43
44 stop_lttng_tracing_ok
45
46 # Clean up the synchronization file
47 rm -f "$start_file_sync"
48}
49
02db71ba
DG
50function validate_list()
51{
52 local session_name=$1
53 local event_name=$2
54 local opt=$3
55
56 out=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list $session_name $opt | grep $event_name)
57 if [ -z "$out" ]; then
58 fail "Validate syscall listing"
59 diag "$event_name not found when listing $session_name (opt $opt)"
60 else
61 pass "Validate syscall listing. Found $event_name."
62 fi
63}
64
65function test_syscall_event_list()
66{
67 local EVENT_NAME="getpid"
68
69 diag "Syscall event listing"
70
71 validate_list "" $EVENT_NAME "-k --syscall"
72}
73
74function test_syscall_simple_list()
75{
76 TRACE_PATH=$(mktemp -d)
77 SESSION_NAME="kernel_syscall_simple_list"
78 local EVENT_NAME="close"
79
80 diag "Syscall simple listing"
81
bf6ae429 82 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
02db71ba
DG
83
84 lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME
85
86 validate_list $SESSION_NAME $EVENT_NAME
87
c8e51d15 88 trace_testapp
02db71ba 89
c8e51d15 90 # ensure all events are in the trace.
02db71ba
DG
91 validate_trace_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME:" $TRACE_PATH
92 validate_trace_exp "-e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH
93
94 # ensure trace only contains those.
95 validate_trace_only_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME: -e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH
96
67b4c664 97 destroy_lttng_session_ok $SESSION_NAME
02db71ba
DG
98
99 rm -rf $TRACE_PATH
100}
101
102function test_syscall_simple_list_two()
103{
104 TRACE_PATH=$(mktemp -d)
105 SESSION_NAME="kernel_syscall_simple_list_two"
106 local EVENT_NAME="close"
107 local EVENT_NAME2="read"
108
109 diag "Syscall simple listing"
110
bf6ae429 111 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
02db71ba
DG
112
113 lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME
114 lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME2
115
116 validate_list $SESSION_NAME $EVENT_NAME
117 validate_list $SESSION_NAME $EVENT_NAME2
118
c8e51d15 119 trace_testapp
02db71ba 120
c8e51d15 121 # ensure all events are in the trace.
02db71ba
DG
122 validate_trace_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME:" $TRACE_PATH
123 validate_trace_exp "-e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH
124
02db71ba
DG
125 validate_trace_exp "-e syscall_entry_$EVENT_NAME2: -e compat_syscall_entry_$EVENT_NAME2:" $TRACE_PATH
126 validate_trace_exp "-e syscall_exit_$EVENT_NAME2: -e compat_syscall_exit_$EVENT_NAME2:" $TRACE_PATH
127
128 # ensure trace only contains those.
129 validate_trace_only_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME: -e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME: -e syscall_entry_$EVENT_NAME2: -e compat_syscall_entry_$EVENT_NAME2: -e syscall_exit_$EVENT_NAME2: -e compat_syscall_exit_$EVENT_NAME2:" $TRACE_PATH
130
67b4c664 131 destroy_lttng_session_ok $SESSION_NAME
02db71ba
DG
132
133 rm -rf $TRACE_PATH
134}
135
8cfcd41c
MD
136function test_syscall_single()
137{
138 TRACE_PATH=$(mktemp -d)
139 SESSION_NAME="kernel_syscall_single"
140
031f232e
DG
141 diag "Syscall trace single"
142
bf6ae429 143 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c 144
8192bd8f 145 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 146
c8e51d15 147 trace_testapp
8cfcd41c 148
c8e51d15 149 # ensure all events are in the trace.
8192bd8f
FD
150 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat:" $TRACE_PATH
151 validate_trace_exp "-e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
8cfcd41c
MD
152
153 # ensure trace only contains those.
8192bd8f 154 validate_trace_only_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat: -e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
8cfcd41c 155
67b4c664 156 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
157
158 rm -rf $TRACE_PATH
159}
160
161function test_syscall_two()
162{
163 TRACE_PATH=$(mktemp -d)
164 SESSION_NAME="kernel_syscall_two"
165
031f232e
DG
166 diag "Syscall trace two events"
167
bf6ae429 168 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c 169
8192bd8f 170 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c
MD
171 lttng_enable_kernel_syscall_ok $SESSION_NAME "close"
172
c8e51d15 173 trace_testapp
8cfcd41c 174
c8e51d15 175 # ensure all events are in the trace.
8192bd8f
FD
176 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat:" $TRACE_PATH
177 validate_trace_exp "-e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
a39bd0ab
MD
178 validate_trace_exp "-e syscall_entry_close: -e compat_syscall_entry_close:" $TRACE_PATH
179 validate_trace_exp "-e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c
MD
180
181 # ensure trace only contains those.
8192bd8f 182 validate_trace_only_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat: -e syscall_exit_openat: -e compat_syscall_exit_openat: -e syscall_entry_close: -e compat_syscall_entry_close: -e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c 183
67b4c664 184 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
185
186 rm -rf $TRACE_PATH
187}
188
189function test_syscall_all()
190{
191 TRACE_PATH=$(mktemp -d)
192 SESSION_NAME="kernel_syscall_all"
193
031f232e
DG
194 diag "Syscall trace all events"
195
bf6ae429 196 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
197
198 # enable all syscalls
199 lttng_enable_kernel_syscall_ok $SESSION_NAME
200
c8e51d15 201 trace_testapp
8cfcd41c
MD
202
203 # ensure at least open and close are there.
8192bd8f
FD
204 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat:" $TRACE_PATH
205 validate_trace_exp "-e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
a39bd0ab
MD
206 validate_trace_exp "-e syscall_entry_close: -e compat_syscall_entry_close:" $TRACE_PATH
207 validate_trace_exp "-e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c
MD
208 # trace may contain other syscalls.
209
67b4c664 210 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
211
212 rm -rf $TRACE_PATH
213}
214
215function test_syscall_all_disable_one()
216{
217 TRACE_PATH=$(mktemp -d)
218 SESSION_NAME="kernel_syscall_all_disable_one"
219
031f232e
DG
220 diag "Syscall trace all events and disable one"
221
bf6ae429 222 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
223
224 # enable all syscalls
225 lttng_enable_kernel_syscall_ok $SESSION_NAME
fac26884
MD
226 # try to disable open system call: fails because enabler semantic of
227 # "all syscalls" is not "the open" system call.
8192bd8f 228 lttng_disable_kernel_syscall_fail $SESSION_NAME "openat"
8cfcd41c 229
c8e51d15 230 trace_testapp
8cfcd41c 231
8192bd8f
FD
232 # ensure "openat" syscall is there.
233 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat: -e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
8cfcd41c
MD
234
235 # ensure "close" syscall is there.
a39bd0ab
MD
236 validate_trace_exp "-e syscall_entry_close: -e compat_syscall_entry_close:" $TRACE_PATH
237 validate_trace_exp "-e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c 238
67b4c664 239 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
240
241 rm -rf $TRACE_PATH
242}
243
244function test_syscall_all_disable_two()
245{
246 TRACE_PATH=$(mktemp -d)
247 SESSION_NAME="kernel_syscall_all_disable_two"
248
031f232e
DG
249 diag "Syscall trace all events and disable two"
250
bf6ae429 251 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
252
253 # enable all syscalls
254 lttng_enable_kernel_syscall_ok $SESSION_NAME
fac26884
MD
255 # try to disable open and close system calls: fails because enabler
256 # semantic of "all syscalls" is not "the open" system call.
8192bd8f 257 lttng_disable_kernel_syscall_fail $SESSION_NAME "openat"
fac26884 258 lttng_disable_kernel_syscall_fail $SESSION_NAME "close"
8cfcd41c 259
c8e51d15 260 trace_testapp
8cfcd41c 261
8192bd8f
FD
262 # ensure "openat" syscall is there.
263 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat: -e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
fac26884
MD
264
265 # ensure "close" syscall is there.
266 validate_trace_exp "-e syscall_entry_close: -e compat_syscall_entry_close:" $TRACE_PATH
267 validate_trace_exp "-e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c 268
c8e51d15
FD
269 # ensure "read" syscall is there.
270 validate_trace_exp "-e syscall_entry_read: -e compat_syscall_entry_read:" $TRACE_PATH
271 validate_trace_exp "-e syscall_exit_read: -e compat_syscall_exit_read:" $TRACE_PATH
8cfcd41c 272
67b4c664 273 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
274
275 rm -rf $TRACE_PATH
276}
277
278function test_syscall_enable_all_disable_all()
279{
280 TRACE_PATH=$(mktemp -d)
281 SESSION_NAME="kernel_syscall_enable_all_disable_all"
282
031f232e
DG
283 diag "Syscall trace all events and disable all"
284
bf6ae429 285 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
286
287 # enable all system calls
288 lttng_enable_kernel_syscall_ok $SESSION_NAME
289 # disable all system calls
290 lttng_disable_kernel_syscall_ok $SESSION_NAME
291
c8e51d15 292 trace_testapp
8cfcd41c
MD
293
294 # ensure nothing has been traced.
295 validate_trace_empty $TRACE_PATH
296
67b4c664 297 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
298
299 rm -rf $TRACE_PATH
300}
301
302function test_syscall_enable_all_disable_all_enable_all()
303{
304 TRACE_PATH=$(mktemp -d)
305 SESSION_NAME="kernel_syscall_enable_all_disable_all_enable_all"
306
031f232e
DG
307 diag "Syscall trace all events and enable/disable all"
308
bf6ae429 309 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
310
311 # enable all system calls
312 lttng_enable_kernel_syscall_ok $SESSION_NAME
313 # disable all system calls
314 lttng_disable_kernel_syscall_ok $SESSION_NAME
315 # enable all system calls
316 lttng_enable_kernel_syscall_ok $SESSION_NAME
317
c8e51d15 318 trace_testapp
8cfcd41c
MD
319
320 # ensure at least open and close are there.
8192bd8f
FD
321 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat:" $TRACE_PATH
322 validate_trace_exp "-e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
a39bd0ab
MD
323 validate_trace_exp "-e syscall_entry_close: -e compat_syscall_entry_close:" $TRACE_PATH
324 validate_trace_exp "-e syscall_exit_close: -e compat_syscall_exit_close:" $TRACE_PATH
8cfcd41c
MD
325 # trace may contain other syscalls.
326
67b4c664 327 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
328
329 rm -rf $TRACE_PATH
330}
331
332function test_syscall_enable_all_disable_all_twice()
333{
334 TRACE_PATH=$(mktemp -d)
335 SESSION_NAME="kernel_syscall_enable_all_disable_all_twice"
336
031f232e
DG
337 diag "Syscall trace all events and enable/disable all twice"
338
bf6ae429 339 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
340
341 # enable all system calls
342 lttng_enable_kernel_syscall_ok $SESSION_NAME
343 # disable all system calls
344 lttng_disable_kernel_syscall_ok $SESSION_NAME
345 # enable all system calls
346 lttng_enable_kernel_syscall_ok $SESSION_NAME
347 # disable all system calls
348 lttng_disable_kernel_syscall_ok $SESSION_NAME
349
c8e51d15 350 trace_testapp
8cfcd41c
MD
351
352 # ensure nothing has been traced.
353 validate_trace_empty $TRACE_PATH
354
67b4c664 355 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
356
357 rm -rf $TRACE_PATH
358}
359
360function test_syscall_enable_one_disable_one()
361{
362 TRACE_PATH=$(mktemp -d)
363 SESSION_NAME="kernel_syscall_enable_one_disable_one"
364
031f232e
DG
365 diag "Syscall trace one event and disable one"
366
bf6ae429 367 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
368
369 # enable open system call
8192bd8f 370 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 371 # disable open system call
8192bd8f 372 lttng_disable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 373
c8e51d15 374 trace_testapp
8cfcd41c
MD
375
376 # ensure nothing has been traced.
377 validate_trace_empty $TRACE_PATH
378
67b4c664 379 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
380
381 rm -rf $TRACE_PATH
382}
383
384function test_syscall_enable_two_disable_two()
385{
386 TRACE_PATH=$(mktemp -d)
387 SESSION_NAME="kernel_syscall_enable_two_disable_two"
388
031f232e
DG
389 diag "Syscall trace two events and disable two"
390
bf6ae429 391 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
392
393 # enable open and close system calls
8192bd8f 394 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c
MD
395 lttng_enable_kernel_syscall_ok $SESSION_NAME "close"
396 # disable open and close system calls
8192bd8f 397 lttng_disable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c
MD
398 lttng_disable_kernel_syscall_ok $SESSION_NAME "close"
399
c8e51d15 400 trace_testapp
8cfcd41c
MD
401
402 # ensure nothing has been traced.
403 validate_trace_empty $TRACE_PATH
404
67b4c664 405 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
406
407 rm -rf $TRACE_PATH
408}
409
410function test_syscall_enable_two_disable_one()
411{
412 TRACE_PATH=$(mktemp -d)
413 SESSION_NAME="kernel_syscall_enable_two_disable_one"
414
031f232e
DG
415 diag "Syscall trace two events and disable one"
416
bf6ae429 417 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
418
419 # enable open and close system calls
8192bd8f 420 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c
MD
421 lttng_enable_kernel_syscall_ok $SESSION_NAME "close"
422 # disable close system call
423 lttng_disable_kernel_syscall_ok $SESSION_NAME "close"
424
c8e51d15 425 trace_testapp
8cfcd41c
MD
426
427 # ensure open is there.
8192bd8f
FD
428 validate_trace_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat:" $TRACE_PATH
429 validate_trace_exp "-e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
8cfcd41c
MD
430
431 # ensure trace only contains those.
8192bd8f 432 validate_trace_only_exp "-e syscall_entry_openat: -e compat_syscall_entry_openat: -e syscall_exit_openat: -e compat_syscall_exit_openat:" $TRACE_PATH
8cfcd41c 433
67b4c664 434 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
435
436 rm -rf $TRACE_PATH
437}
438
439function test_syscall_disable_twice()
440{
441 TRACE_PATH=$(mktemp -d)
442 SESSION_NAME="kernel_syscall_disable_twice"
443
031f232e
DG
444 diag "Syscall trace one event and disable twice"
445
bf6ae429 446 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c 447
8192bd8f 448 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 449 # First disable will succeed
8192bd8f 450 lttng_disable_kernel_syscall_ok $SESSION_NAME "openat"
fac26884 451 # Second disable succeeds too, due to enabler semantic.
8192bd8f 452 lttng_disable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 453
67b4c664 454 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
455
456 rm -rf $TRACE_PATH
457}
458
459function test_syscall_disable_all_twice()
460{
461 TRACE_PATH=$(mktemp -d)
462 SESSION_NAME="kernel_syscall_disable_all_twice"
463
031f232e
DG
464 diag "Syscall trace all events and disable all twice"
465
bf6ae429 466 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
467
468 lttng_enable_kernel_syscall_ok $SESSION_NAME
469 # First disable will succeed
470 lttng_disable_kernel_syscall_ok $SESSION_NAME
fac26884
MD
471 # Second disable succeeds too, due to enabler semantic.
472 lttng_disable_kernel_syscall_ok $SESSION_NAME
8cfcd41c 473
67b4c664 474 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
475
476 rm -rf $TRACE_PATH
477}
478
479
480function test_syscall_enable_unknown()
481{
482 TRACE_PATH=$(mktemp -d)
483 SESSION_NAME="kernel_syscall_enable_unknown"
484
031f232e
DG
485 diag "Syscall enable an unknown event"
486
bf6ae429 487 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c 488
fac26884
MD
489 # Enabling a syscall that does not exist succeeds, due to enabler
490 # semantic.
491 lttng_enable_kernel_syscall_ok $SESSION_NAME "thissyscallcannotexist"
8cfcd41c 492
67b4c664 493 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
494
495 rm -rf $TRACE_PATH
496}
497
498function test_syscall_enable_all_enable_one()
499{
500 TRACE_PATH=$(mktemp -d)
501 SESSION_NAME="kernel_syscall_enable_all_enable_one"
502
031f232e
DG
503 diag "Syscall enable all and enable one"
504
bf6ae429 505 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
506
507 lttng_enable_kernel_syscall_ok $SESSION_NAME
fac26884 508 # Enabling an event already enabled succeeds, due to enabler semantic.
8192bd8f 509 lttng_enable_kernel_syscall_ok $SESSION_NAME "openat"
8cfcd41c 510
67b4c664 511 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
512
513 rm -rf $TRACE_PATH
514}
515
516function test_syscall_disable_all_disable_one()
517{
518 TRACE_PATH=$(mktemp -d)
519 SESSION_NAME="kernel_syscall_enable_all_enable_one"
520
031f232e
DG
521 diag "Syscall disable all and disable one"
522
bf6ae429 523 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
8cfcd41c
MD
524
525 lttng_enable_kernel_syscall_ok $SESSION_NAME
526 lttng_disable_kernel_syscall_ok $SESSION_NAME
527 # Disabling an event already disabled fails.
8192bd8f 528 lttng_disable_kernel_syscall_fail $SESSION_NAME "openat"
8cfcd41c 529
67b4c664 530 destroy_lttng_session_ok $SESSION_NAME
8cfcd41c
MD
531
532 rm -rf $TRACE_PATH
533}
534
d96f6315
MD
535function test_syscall_enable_channel_disable_all()
536{
537 TRACE_PATH=$(mktemp -d)
538 SESSION_NAME="kernel_syscall_enable_channel_disable_all"
539 CHANNEL_NAME="channel"
540
031f232e
DG
541 diag "Syscall enable channel and disable all"
542
bf6ae429 543 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
d96f6315
MD
544
545 lttng_enable_kernel_channel_ok $SESSION_NAME $CHANNEL_NAME
fac26884
MD
546 # sessiond semantic for "disable all" is to try to match all enalers
547 # it knowns about. Disable all succeeds if it finds no match.
548 lttng_disable_kernel_syscall_ok $SESSION_NAME "-a" $CHANNEL_NAME
d96f6315 549
67b4c664 550 destroy_lttng_session_ok $SESSION_NAME
d96f6315
MD
551
552 rm -rf $TRACE_PATH
553}
554
555function test_syscall_enable_channel_disable_one()
556{
557 TRACE_PATH=$(mktemp -d)
558 SESSION_NAME="kernel_syscall_enable_channel_disable_all"
559 CHANNEL_NAME="channel"
560
031f232e
DG
561 diag "Syscall enable channel and disable one"
562
bf6ae429 563 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
d96f6315
MD
564
565 lttng_enable_kernel_channel_ok $SESSION_NAME $CHANNEL_NAME
8192bd8f 566 lttng_disable_kernel_syscall_fail $SESSION_NAME "openat" $CHANNEL_NAME
d96f6315 567
67b4c664 568 destroy_lttng_session_ok $SESSION_NAME
d96f6315
MD
569
570 rm -rf $TRACE_PATH
571}
572
8cfcd41c
MD
573# MUST set TESTDIR before calling those functions
574plan_tests $NUM_TESTS
575
576print_test_banner "$TEST_DESC"
577
578if [ "$(id -u)" == "0" ]; then
579 isroot=1
580else
581 isroot=0
582fi
583
584skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
585{
586 start_lttng_sessiond
587
02db71ba
DG
588 test_syscall_event_list
589 test_syscall_simple_list
590 test_syscall_simple_list_two
8cfcd41c
MD
591 test_syscall_single
592 test_syscall_two
593 test_syscall_all
594 test_syscall_all_disable_one
595 test_syscall_all_disable_two
596 test_syscall_enable_all_disable_all
597 test_syscall_enable_all_disable_all_enable_all
598 test_syscall_enable_all_disable_all_twice
599 test_syscall_enable_one_disable_one
600 test_syscall_enable_two_disable_two
601 test_syscall_enable_two_disable_one
602 test_syscall_disable_twice
603 test_syscall_disable_all_twice
604 test_syscall_enable_unknown
605 test_syscall_enable_all_enable_one
606 test_syscall_disable_all_disable_one
d96f6315
MD
607 test_syscall_enable_channel_disable_all
608 test_syscall_enable_channel_disable_one
8cfcd41c
MD
609
610 stop_lttng_sessiond
611}
This page took 0.121671 seconds and 5 git commands to generate.