Commit | Line | Data |
---|---|---|
ba5e8d0a MD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com> | |
4 | # Copyright (C) - 2015-2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License, version 2 only, as | |
8 | # published by the Free Software Foundation. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, but WITHOUT | |
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | # more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License along with | |
16 | # this program; if not, write to the Free Software Foundation, Inc., 51 | |
17 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | ||
19 | TEST_DESC="LTTng - Event traker test" | |
20 | ||
21 | CURDIR=$(dirname "$0")/ | |
22 | TESTDIR="$CURDIR/../../.." | |
23 | TESTAPP_PATH="$TESTDIR/utils/testapp" | |
24 | TESTAPP_NAME="gen-ust-events" | |
25 | TESTAPP_KERNEL_NAME="gen-kernel-test-events" | |
26 | TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" | |
27 | TESTAPP_KERNEL_BIN="$TESTAPP_PATH/$TESTAPP_KERNEL_NAME/$TESTAPP_KERNEL_NAME" | |
28 | SESSION_NAME="tracker" | |
29 | NR_ITER=100 | |
30 | NUM_GLOBAL_TESTS=2 | |
14d3fca9 | 31 | NUM_UST_TESTS=265 |
ba5e8d0a MD |
32 | NUM_KERNEL_TESTS=462 |
33 | NUM_TESTS=$((NUM_UST_TESTS+NUM_KERNEL_TESTS+NUM_GLOBAL_TESTS)) | |
34 | ||
35 | NR_USEC_WAIT=0 #for UST gen events | |
36 | ||
37 | SCRIPT_UID="$(id -u)" | |
38 | SCRIPT_GID="$(id -g)" | |
39 | SCRIPT_USERNAME="$(id -un)" | |
40 | SCRIPT_GROUPNAME="$(id -gn)" | |
41 | ||
42 | CHILD_PID=-1 | |
43 | WAIT_PATH= | |
44 | AFTER_FIRST_PATH= | |
45 | BEFORE_LAST_PATH= | |
46 | ||
47 | source $TESTDIR/utils/utils.sh | |
48 | ||
49 | function prepare_ust_app | |
50 | { | |
51 | AFTER_FIRST_PATH=$(mktemp -u) | |
52 | BEFORE_LAST_PATH=$(mktemp -u) | |
53 | ||
54 | $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a "$AFTER_FIRST_PATH" -b "$BEFORE_LAST_PATH" & | |
55 | CHILD_PID=$! | |
56 | } | |
57 | ||
58 | function trace_ust_app | |
59 | { | |
60 | touch "$BEFORE_LAST_PATH" | |
61 | wait | |
62 | ok $? "Traced application stopped." | |
63 | rm "$BEFORE_LAST_PATH" | |
64 | rm "$AFTER_FIRST_PATH" | |
65 | } | |
66 | ||
67 | function prepare_kernel_app | |
68 | { | |
69 | WAIT_PATH=$(mktemp -u) | |
70 | ||
71 | "$TESTAPP_KERNEL_BIN" "$WAIT_PATH" $NR_ITER & | |
72 | CHILD_PID=$! | |
73 | } | |
74 | ||
75 | function trace_kernel_app | |
76 | { | |
77 | touch "$WAIT_PATH" | |
78 | wait | |
79 | ok $? "Traced application stopped." | |
80 | rm "$WAIT_PATH" | |
81 | } | |
82 | ||
83 | function test_event_tracker() | |
84 | { | |
85 | local trace_path | |
86 | local domain="$1" | |
87 | local expect_event="$2" | |
88 | local wildcard="$3" | |
89 | local tracker="$4" | |
90 | local channel='' | |
91 | ||
92 | trace_path=$(mktemp -d) | |
93 | ||
94 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
95 | ||
96 | if [ "$domain" = kernel ]; then | |
97 | channel=chan | |
98 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
99 | fi | |
100 | ||
101 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
102 | ||
103 | start_lttng_tracing_ok | |
104 | ||
105 | lttng_track_"$domain"_ok "${tracker}" | |
106 | ||
107 | prepare_"$domain"_app | |
108 | ||
109 | trace_"$domain"_app | |
110 | ||
111 | stop_lttng_tracing_ok | |
112 | destroy_lttng_session_ok $SESSION_NAME | |
113 | ||
114 | if [ "$expect_event" -eq 1 ]; then | |
115 | trace_matches "$EVENT_NAME" $NR_ITER "$trace_path" | |
116 | else | |
117 | validate_trace_session_"$domain"_empty "$trace_path" | |
118 | fi | |
119 | ||
120 | rm -rf "$trace_path" | |
121 | } | |
122 | ||
123 | function test_event_vpid_tracker() | |
124 | { | |
125 | local trace_path | |
126 | local domain="$1" | |
127 | local expect_event="$2" | |
128 | local wildcard="$3" | |
129 | local channel='' | |
130 | ||
131 | trace_path=$(mktemp -d) | |
132 | ||
133 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
134 | ||
135 | if [ "$domain" = kernel ]; then | |
136 | channel=chan | |
137 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
138 | fi | |
139 | ||
140 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
141 | ||
142 | prepare_"$domain"_app | |
143 | ||
144 | start_lttng_tracing_ok | |
145 | ||
146 | if [ "$expect_event" -eq 1 ]; then | |
147 | lttng_track_"$domain"_ok "--vpid ${CHILD_PID}" | |
148 | else | |
149 | lttng_track_"$domain"_ok "--vpid $((CHILD_PID+1))" | |
150 | fi | |
151 | ||
152 | trace_"$domain"_app | |
153 | ||
154 | stop_lttng_tracing_ok | |
155 | destroy_lttng_session_ok $SESSION_NAME | |
156 | ||
157 | if [ "$expect_event" -eq 1 ]; then | |
158 | validate_trace "$EVENT_NAME" "$trace_path" | |
159 | else | |
160 | validate_trace_empty "$trace_path" | |
161 | fi | |
162 | ||
163 | rm -rf "$trace_path" | |
164 | } | |
165 | ||
166 | function test_event_pid_tracker() | |
167 | { | |
168 | local trace_path | |
169 | local domain="$1" | |
170 | local expect_event="$2" | |
171 | local wildcard="$3" | |
172 | local channel='' | |
173 | ||
174 | trace_path=$(mktemp -d) | |
175 | ||
176 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
177 | ||
178 | if [ "$domain" = kernel ]; then | |
179 | channel=chan | |
180 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
181 | fi | |
182 | ||
183 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
184 | ||
185 | prepare_"$domain"_app | |
186 | ||
187 | start_lttng_tracing_ok | |
188 | ||
189 | if [ "$expect_event" -eq 1 ]; then | |
190 | lttng_track_"$domain"_ok "--pid ${CHILD_PID}" | |
191 | else | |
192 | lttng_track_"$domain"_ok "--pid $((CHILD_PID+1))" | |
193 | fi | |
194 | ||
195 | trace_"$domain"_app | |
196 | ||
197 | stop_lttng_tracing_ok | |
198 | destroy_lttng_session_ok $SESSION_NAME | |
199 | ||
200 | if [ "$expect_event" -eq 1 ]; then | |
201 | validate_trace "$EVENT_NAME" "$trace_path" | |
202 | else | |
203 | validate_trace_empty "$trace_path" | |
204 | fi | |
205 | ||
206 | rm -rf "$trace_path" | |
207 | } | |
208 | ||
209 | ||
210 | function test_event_tracker_fail() | |
211 | { | |
212 | local trace_path | |
213 | local domain="$1" | |
214 | local wildcard="$2" | |
215 | local tracker="$3" | |
216 | ||
217 | trace_path=$(mktemp -d) | |
218 | ||
219 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
220 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" | |
221 | lttng_track_"$domain"_fail "${tracker}" | |
222 | destroy_lttng_session_ok $SESSION_NAME | |
223 | ||
224 | rm -rf "$trace_path" | |
225 | } | |
226 | ||
227 | function test_event_track_untrack() | |
228 | { | |
229 | local trace_path | |
230 | local domain="$1" | |
231 | local expect_event="$2" | |
232 | local wildcard="$3" | |
233 | local tracker="$4" | |
234 | local channel='' | |
235 | ||
236 | trace_path=$(mktemp -d) | |
237 | ||
238 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
239 | ||
240 | if [ "$domain" = kernel ]; then | |
241 | channel=chan | |
242 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
243 | fi | |
244 | ||
245 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
246 | ||
247 | start_lttng_tracing_ok | |
248 | ||
249 | lttng_track_"$domain"_ok "${tracker}" | |
250 | lttng_untrack_"$domain"_ok "${tracker}" | |
251 | ||
252 | prepare_"$domain"_app | |
253 | ||
254 | trace_"$domain"_app | |
255 | ||
256 | stop_lttng_tracing_ok | |
257 | destroy_lttng_session_ok $SESSION_NAME | |
258 | ||
259 | if [ "$expect_event" -eq 1 ]; then | |
260 | trace_matches "$EVENT_NAME" $NR_ITER "$trace_path" | |
261 | else | |
262 | validate_trace_session_"$domain"_empty "$trace_path" | |
263 | fi | |
264 | ||
265 | rm -rf "$trace_path" | |
266 | } | |
267 | ||
268 | function test_event_vpid_track_untrack() | |
269 | { | |
270 | local trace_path | |
271 | local domain="$1" | |
272 | local expect_event="$2" | |
273 | local wildcard="$3" | |
274 | local channel='' | |
275 | ||
276 | trace_path=$(mktemp -d) | |
277 | ||
278 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
279 | ||
280 | if [ "$domain" = kernel ]; then | |
281 | channel=chan | |
282 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
283 | fi | |
284 | ||
285 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
286 | ||
287 | prepare_"$domain"_app | |
288 | ||
289 | start_lttng_tracing_ok | |
290 | ||
291 | lttng_track_"$domain"_ok "--vpid ${CHILD_PID}" | |
292 | lttng_untrack_"$domain"_ok "--vpid ${CHILD_PID}" | |
293 | ||
294 | trace_"$domain"_app | |
295 | ||
296 | stop_lttng_tracing_ok | |
297 | destroy_lttng_session_ok $SESSION_NAME | |
298 | ||
299 | if [ "$expect_event" -eq 1 ]; then | |
300 | validate_trace "$EVENT_NAME" "$trace_path" | |
301 | else | |
302 | validate_trace_empty "$trace_path" | |
303 | fi | |
304 | ||
305 | rm -rf "$trace_path" | |
306 | } | |
307 | ||
308 | function test_event_pid_track_untrack() | |
309 | { | |
310 | local trace_path | |
311 | local domain="$1" | |
312 | local expect_event="$2" | |
313 | local wildcard="$3" | |
314 | local channel='' | |
315 | ||
316 | trace_path=$(mktemp -d) | |
317 | ||
318 | create_lttng_session_ok $SESSION_NAME "$trace_path" | |
319 | ||
320 | if [ "$domain" = kernel ]; then | |
321 | channel=chan | |
322 | lttng_enable_kernel_channel 1 0 $SESSION_NAME $channel "--subbuf-size=8M --num-subbuf=4" | |
323 | fi | |
324 | ||
325 | enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" "$channel" | |
326 | ||
327 | prepare_"$domain"_app | |
328 | ||
329 | start_lttng_tracing_ok | |
330 | ||
331 | lttng_track_"$domain"_ok "--pid ${CHILD_PID}" | |
332 | lttng_untrack_"$domain"_ok "--pid ${CHILD_PID}" | |
333 | ||
334 | trace_"$domain"_app | |
335 | ||
336 | stop_lttng_tracing_ok | |
337 | destroy_lttng_session_ok $SESSION_NAME | |
338 | ||
339 | if [ "$expect_event" -eq 1 ]; then | |
340 | validate_trace "$EVENT_NAME" "$trace_path" | |
341 | else | |
342 | validate_trace_empty "$trace_path" | |
343 | fi | |
344 | ||
345 | rm -rf "$trace_path" | |
346 | } | |
347 | ||
14d3fca9 JR |
348 | function test_event_ust_vpid_untrack_snapshot() |
349 | { | |
350 | local trace_path | |
351 | ||
352 | trace_path=$(mktemp -d) | |
353 | ||
354 | diag "Test_event_ust_vpid_untrack_snapshot" | |
355 | ||
356 | create_lttng_session_ok $SESSION_NAME "$trace_path" "--snapshot" | |
357 | ||
358 | enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" | |
359 | ||
360 | prepare_ust_app | |
361 | ||
362 | lttng_untrack_ust_ok "--vpid --all" | |
363 | ||
364 | start_lttng_tracing_ok | |
365 | ||
366 | trace_ust_app | |
367 | lttng_snapshot_record $SESSION_NAME | |
368 | ||
369 | stop_lttng_tracing_ok | |
370 | destroy_lttng_session_ok $SESSION_NAME | |
371 | ||
372 | snapshot_count=$(find "$trace_path" -name metadata | wc -l) | |
373 | is "$snapshot_count" 0 "Number of snapshot is zero" | |
374 | ||
375 | rm -rf "$trace_path" | |
376 | } | |
377 | ||
ba5e8d0a MD |
378 | # MUST set TESTDIR before calling those functions |
379 | plan_tests $NUM_TESTS | |
380 | ||
381 | print_test_banner "$TEST_DESC" | |
382 | ||
383 | start_lttng_sessiond | |
384 | ||
385 | diag "Test UST tracker" | |
386 | ||
387 | if [ ! -x "$TESTAPP_BIN" ]; then | |
388 | BAIL_OUT "No UST nevents binary detected." | |
389 | fi | |
390 | ||
391 | EVENT_NAME="tp:tptest" | |
392 | ||
393 | #vuid, vgid | |
394 | ||
395 | # non-matching | |
396 | test_event_tracker ust 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1))" | |
397 | test_event_tracker ust 0 "${EVENT_NAME}" "--vgid $((SCRIPT_GID+1))" | |
398 | test_event_tracker ust 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1)) --vgid $((SCRIPT_GID+1))" | |
399 | test_event_tracker ust 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1)) --vgid ${SCRIPT_GID}" | |
400 | test_event_tracker ust 0 "${EVENT_NAME}" "--vuid ${SCRIPT_UID} --vgid $((SCRIPT_GID+1))" | |
401 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--vuid ${SCRIPT_UID}" | |
402 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--vgid ${SCRIPT_GID}" | |
403 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--vuid --all" | |
404 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--vgid --all" | |
405 | ||
406 | # matching | |
407 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID}" | |
408 | test_event_tracker ust 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GID}" | |
409 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID} --vgid ${SCRIPT_GID}" | |
410 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid ${SCRIPT_USERNAME}" | |
411 | test_event_tracker ust 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GROUPNAME}" | |
412 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID},$((SCRIPT_UID+1))" | |
413 | test_event_tracker ust 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GID},$((SCRIPT_GID+1))" | |
414 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid ${SCRIPT_USERNAME},$((SCRIPT_UID+1))" | |
415 | test_event_tracker ust 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GROUPNAME},$((SCRIPT_GID+1))" | |
416 | test_event_tracker ust 1 "${EVENT_NAME}" "--vuid --all" | |
417 | test_event_tracker ust 1 "${EVENT_NAME}" "--vgid --all" | |
418 | ||
419 | #fail | |
420 | test_event_tracker_fail ust "${EVENT_NAME}" "--vuid lttng_unexisting_user" | |
421 | test_event_tracker_fail ust "${EVENT_NAME}" "--vgid lttng_unexisting_group" | |
422 | ||
423 | ||
424 | #vpid | |
425 | ||
426 | #non-matching | |
427 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--vpid --all" | |
428 | test_event_vpid_tracker ust 0 "${EVENT_NAME}" | |
429 | test_event_vpid_track_untrack ust 0 "${EVENT_NAME}" | |
430 | ||
431 | #matching | |
432 | test_event_tracker ust 1 "${EVENT_NAME}" "--vpid --all" | |
433 | test_event_vpid_tracker ust 1 "${EVENT_NAME}" | |
434 | ||
14d3fca9 JR |
435 | #snapshot untrack vpid |
436 | ||
437 | test_event_ust_vpid_untrack_snapshot | |
438 | ||
ba5e8d0a MD |
439 | #pid (backward compat) |
440 | ||
441 | #non-matching | |
442 | test_event_pid_tracker ust 0 "${EVENT_NAME}" | |
443 | test_event_pid_track_untrack ust 0 "${EVENT_NAME}" | |
444 | test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat | |
445 | ||
446 | #matching | |
447 | test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat | |
448 | test_event_pid_tracker ust 1 "${EVENT_NAME}" | |
449 | ||
450 | if [ "$(id -u)" == "0" ]; then | |
451 | isroot=1 | |
452 | else | |
453 | isroot=0 | |
454 | fi | |
455 | ||
456 | skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS || | |
457 | { | |
458 | diag "Test kernel tracker" | |
459 | ||
460 | modprobe lttng-test | |
461 | ok $? "Loading lttng-test module" | |
462 | ||
463 | EVENT_NAME="lttng_test_filter_event" | |
464 | ||
465 | # vuid, vgid, vpid | |
466 | ||
467 | # non-matching | |
468 | test_event_tracker kernel 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1))" | |
469 | test_event_tracker kernel 0 "${EVENT_NAME}" "--vgid $((SCRIPT_GID+1))" | |
470 | test_event_tracker kernel 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1)) --vgid $((SCRIPT_GID+1))" | |
471 | test_event_tracker kernel 0 "${EVENT_NAME}" "--vuid $((SCRIPT_UID+1)) --vgid ${SCRIPT_GID}" | |
472 | test_event_tracker kernel 0 "${EVENT_NAME}" "--vuid ${SCRIPT_UID} --vgid $((SCRIPT_GID+1))" | |
473 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--vuid ${SCRIPT_UID}" | |
474 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--vgid ${SCRIPT_GID}" | |
475 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--vuid --all" | |
476 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--vgid --all" | |
477 | ||
478 | # matching | |
479 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID}" | |
480 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GID}" | |
481 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID} --vgid ${SCRIPT_GID}" | |
482 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid ${SCRIPT_USERNAME}" | |
483 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GROUPNAME}" | |
484 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid ${SCRIPT_UID},$((SCRIPT_UID+1))" | |
485 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GID},$((SCRIPT_GID+1))" | |
486 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid ${SCRIPT_USERNAME},$((SCRIPT_UID+1))" | |
487 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vgid ${SCRIPT_GROUPNAME},$((SCRIPT_GID+1))" | |
488 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vuid --all" | |
489 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vgid --all" | |
490 | ||
491 | #fail | |
492 | test_event_tracker_fail kernel "${EVENT_NAME}" "--vuid lttng_unexisting_user" | |
493 | test_event_tracker_fail kernel "${EVENT_NAME}" "--vgid lttng_unexisting_group" | |
494 | ||
495 | ||
496 | #uid, gid | |
497 | ||
498 | # non-matching | |
499 | test_event_tracker kernel 0 "${EVENT_NAME}" "--uid $((SCRIPT_UID+1))" | |
500 | test_event_tracker kernel 0 "${EVENT_NAME}" "--gid $((SCRIPT_GID+1))" | |
501 | test_event_tracker kernel 0 "${EVENT_NAME}" "--uid $((SCRIPT_UID+1)) --gid $((SCRIPT_GID+1))" | |
502 | test_event_tracker kernel 0 "${EVENT_NAME}" "--uid $((SCRIPT_UID+1)) --gid ${SCRIPT_GID}" | |
503 | test_event_tracker kernel 0 "${EVENT_NAME}" "--uid ${SCRIPT_UID} --gid $((SCRIPT_GID+1))" | |
504 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--uid ${SCRIPT_UID}" | |
505 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--gid ${SCRIPT_GID}" | |
506 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--uid --all" | |
507 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--gid --all" | |
508 | ||
509 | # matching | |
510 | test_event_tracker kernel 1 "${EVENT_NAME}" "--uid ${SCRIPT_UID}" | |
511 | test_event_tracker kernel 1 "${EVENT_NAME}" "--gid ${SCRIPT_GID}" | |
512 | test_event_tracker kernel 1 "${EVENT_NAME}" "--uid ${SCRIPT_UID} --gid ${SCRIPT_GID}" | |
513 | test_event_tracker kernel 1 "${EVENT_NAME}" "--uid ${SCRIPT_USERNAME}" | |
514 | test_event_tracker kernel 1 "${EVENT_NAME}" "--gid ${SCRIPT_GROUPNAME}" | |
515 | test_event_tracker kernel 1 "${EVENT_NAME}" "--uid ${SCRIPT_UID},$((SCRIPT_UID+1))" | |
516 | test_event_tracker kernel 1 "${EVENT_NAME}" "--gid ${SCRIPT_GID},$((SCRIPT_GID+1))" | |
517 | test_event_tracker kernel 1 "${EVENT_NAME}" "--uid ${SCRIPT_USERNAME},$((SCRIPT_UID+1))" | |
518 | test_event_tracker kernel 1 "${EVENT_NAME}" "--gid ${SCRIPT_GROUPNAME},$((SCRIPT_GID+1))" | |
519 | ||
520 | #fail | |
521 | test_event_tracker_fail kernel "${EVENT_NAME}" "--uid lttng_unexisting_user" | |
522 | test_event_tracker_fail kernel "${EVENT_NAME}" "--gid lttng_unexisting_group" | |
523 | ||
524 | ||
525 | #vpid | |
526 | ||
527 | #non-matching | |
528 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--vpid --all" | |
529 | test_event_vpid_tracker kernel 0 "${EVENT_NAME}" | |
530 | test_event_vpid_track_untrack kernel 0 "${EVENT_NAME}" | |
531 | ||
532 | #matching | |
533 | test_event_tracker kernel 1 "${EVENT_NAME}" "--vpid --all" | |
534 | test_event_vpid_tracker kernel 1 "${EVENT_NAME}" | |
535 | ||
536 | #pid | |
537 | ||
538 | #non-matching | |
539 | test_event_pid_tracker kernel 0 "${EVENT_NAME}" | |
540 | test_event_pid_track_untrack kernel 0 "${EVENT_NAME}" | |
541 | test_event_track_untrack kernel 0 "${EVENT_NAME}" "--pid --all" | |
542 | ||
543 | #matching | |
544 | test_event_tracker kernel 1 "${EVENT_NAME}" "--pid --all" | |
545 | test_event_pid_tracker kernel 1 "${EVENT_NAME}" | |
546 | ||
547 | rmmod lttng-test | |
548 | ok $? "Unloading lttng-test module" | |
549 | } | |
550 | ||
551 | stop_lttng_sessiond |