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