port: add missing attributes in getrandom_nonblock() on macOS
[lttng-tools.git] / tests / regression / tools / trigger / test_add_trigger_cli
1 #!/bin/bash
2 #
3 # Copyright (C) - 2020 EfficiOS, inc
4 #
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.
8 #
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
12 # details.
13 #
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
17
18 # Test the `lttng add-trigger` command line interface.
19
20 CURDIR="$(dirname "$0")"
21 TESTDIR="$CURDIR/../../.."
22
23 # shellcheck source=../../../utils/utils.sh
24 source "$TESTDIR/utils/utils.sh"
25
26 plan_tests 295
27
28 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
29
30 # shellcheck disable=SC2119
31 start_lttng_sessiond_notap
32
33 tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX)
34 tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX)
35 uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary"
36
37 if [ "$(id -u)" == "0" ]; then
38 ist_root=1
39 else
40 ist_root=0
41 fi
42
43 function test_success ()
44 {
45 local test_name="$1"
46 local trigger_name="$2"
47 shift 2
48
49 diag "${FULL_LTTNG_BIN} add-trigger $*"
50 set -x
51 "${FULL_LTTNG_BIN}" add-trigger "$@" > "${tmp_stdout}" 2> "${tmp_stderr}"
52 ok $? "${test_name}: exit code is 0"
53 set +x
54
55 diff -u "${tmp_stdout}" <(echo "Added trigger \`$trigger_name\`.")
56 ok $? "${test_name}: expected stdout"
57
58 diff -u "${tmp_stderr}" /dev/null
59 ok $? "${test_name}: expected stderr"
60 }
61
62 function test_failure ()
63 {
64 local test_name="$1"
65 local error_msg="$2"
66
67 shift 2
68
69 diag "${FULL_LTTNG_BIN} add-trigger $*"
70 "${FULL_LTTNG_BIN}" add-trigger "$@" > "${tmp_stdout}" 2> "${tmp_stderr}"
71 isnt $? 0 "${test_name}: exit code is not 0"
72
73 diff -u "${tmp_stdout}" /dev/null
74 ok $? "${test_name}: expected stdout"
75
76 diff -u "${tmp_stderr}" <(echo "${error_msg}")
77 ok $? "${test_name}: expected stderr"
78 }
79
80 function test_mi ()
81 {
82 local tmp_stdout_raw
83 local tmp_expected_stdout
84
85 # Concretely the code used to serialize a trigger object is the same as
86 # the one used by the list command. Here we simply validate that a
87 # simple trigger is correctly generated.
88
89 tmp_stdout_raw=$(mktemp -t "tmp.${FUNCNAME[0]}_stdout.XXXXXX")
90 tmp_expected_stdout=$(mktemp -t "tmp.${FUNCNAME[0]}_expected_stdout.XXXXXX")
91
92 diag "${FULL_LTTNG_BIN} --mi=xml add-trigger"
93
94 cat > "${tmp_expected_stdout}" <<- EOF
95 <?xml version="1.0" encoding="UTF-8"?>
96 <command xmlns="https://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://lttng.org/xml/ns/lttng-mi https://lttng.org/xml/schemas/lttng-mi/${MI_XSD_MAJOR_VERSION}/lttng-mi-${MI_XSD_MAJOR_VERSION}.${MI_XSD_MINOR_VERSION}.xsd" schemaVersion="${MI_XSD_MAJOR_VERSION}.${MI_XSD_MINOR_VERSION}">
97 <name>add-trigger</name>
98 <output>
99 <trigger>
100 <name>mi_hohoho</name>
101 <owner_uid>${UID}</owner_uid>
102 <condition>
103 <condition_event_rule_matches>
104 <event_rule>
105 <event_rule_user_tracepoint>
106 <name_pattern>some-event-id</name_pattern>
107 </event_rule_user_tracepoint>
108 </event_rule>
109 <capture_descriptors/>
110 </condition_event_rule_matches>
111 </condition>
112 <action>
113 <action_list>
114 <action>
115 <action_notify>
116 <rate_policy>
117 <rate_policy_every_n>
118 <interval>1</interval>
119 </rate_policy_every_n>
120 </rate_policy>
121 </action_notify>
122 </action>
123 </action_list>
124 </action>
125 </trigger>
126 </output>
127 <success>true</success>
128 </command>
129 EOF
130
131 "${FULL_LTTNG_BIN}" --mi xml add-trigger --name mi_hohoho \
132 --condition event-rule-matches --name=some-event-id --type=user \
133 --action notify > "${tmp_stdout_raw}" 2> "${tmp_stderr}"
134
135 ok $? "add-trigger mi: exit code is 0"
136
137 # Pretty-fy xml before further test.
138 $XML_PRETTY < "${tmp_stdout_raw}" > "${tmp_stdout}"
139
140 $MI_VALIDATE "${tmp_stdout}"
141 ok $? "add-trigger mi is valid"
142
143 diff -u "${tmp_expected_stdout}" "${tmp_stdout}"
144 ok $? "mi: expected stdout"
145
146 diff -u "${tmp_stderr}" /dev/null
147 ok $? "mi: expected stderr"
148
149 rm -f "${tmp_stdout_raw}"
150 }
151
152 # top-level options
153 test_success "explicit name" "hohoho" \
154 --name hohoho \
155 --condition event-rule-matches --type=user \
156 --action notify
157
158 # `--condition event-rule-matches` successes
159 test_success "--condition event-rule-matches some-event --type=user" \
160 "some-event" \
161 --name=some-event --condition event-rule-matches --type=user \
162 --action notify
163
164 test_success "--condition event-rule-matches --type=user" "trigger0" \
165 --condition event-rule-matches --type=user \
166 --action notify
167
168 test_success "notify action policies" "test-rate-policy-1" \
169 --name=test-rate-policy-1 \
170 --condition event-rule-matches --type=user \
171 --action notify \
172 --rate-policy=every:55 \
173 --action notify \
174 --rate-policy=once-after:55
175
176 test_success "start session action policies" "test-rate-policy-2" \
177 --name=test-rate-policy-2 \
178 --condition event-rule-matches --type=user \
179 --action start-session my_session \
180 --rate-policy=every:55 \
181 --action start-session my_session \
182 --rate-policy=once-after:55
183
184 test_success "stop session action policies" "test-rate-policy-3" \
185 --name=test-rate-policy-3 \
186 --condition event-rule-matches --type=user \
187 --action stop-session my_session \
188 --rate-policy=every:55 \
189 --action stop-session my_session \
190 --rate-policy=once-after:55
191
192 test_success "snapshot session action policies" "test-rate-policy-4" \
193 --name=test-rate-policy-4 \
194 --condition event-rule-matches --type=user \
195 --action snapshot-session my_session \
196 --rate-policy=every:55 \
197 --action snapshot-session my_session \
198 --rate-policy=once-after:55
199
200 test_success "rotate session action policies" "test-rate-policy-5" \
201 --name=test-rate-policy-5 \
202 --condition event-rule-matches --type=user \
203 --action rotate-session my_session \
204 --rate-policy=every:55 \
205 --action rotate-session my_session \
206 --rate-policy=once-after:55
207
208 test_success "--log-level single level" "trigger1" \
209 --condition event-rule-matches --type=user --log-level=INFO \
210 --action notify
211
212 test_success "--log-level range open max" "trigger2" \
213 --condition event-rule-matches --type=user --log-level=INFO.. \
214 --action notify
215
216 test_success "--log-level range any" "trigger3" \
217 --condition event-rule-matches --type=user --log-level=.. \
218 --action notify
219
220 test_success "--exclude-name one" "trigger4" \
221 --condition event-rule-matches --type=user --name='bernard*' --exclude-name=bernard-lermite \
222 --action notify
223
224 test_success "--exclude-name two" "trigger5" \
225 --condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \
226 --action notify
227
228 skip $ist_root "non-root user: skipping kprobe tests" 18 || {
229 i=0
230
231 for type in kprobe kernel:kprobe; do
232 test_success "--condition event-rule-matches probe by symbol" "kprobe-trigger-$i" \
233 --name="kprobe-trigger-$i" \
234 --condition event-rule-matches --type=$type --location=lttng_channel_enable --event-name=my_channel_enable \
235 --action notify
236
237 channel_enable_addr=$(grep ' t lttng_channel_enable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
238 channel_disable_addr=$(grep ' t lttng_channel_disable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
239
240 # We need to find a valid offset.
241 base_symbol=""
242 offset=0
243 if [[ 0x$channel_enable_addr -lt 0x$channel_disable_addr ]]; then
244 base_symbol="lttng_channel_enable"
245 offset=$(( 0x$channel_disable_addr - 0x$channel_enable_addr ))
246 else
247 base_symbol="lttng_channel_disable"
248 offset=$(( 0x$channel_enable_addr - 0x$channel_disable_addr ))
249 fi
250
251 offset_hex="0x$(printf '%x' $offset)"
252
253
254 test_success "--condition event-rule-matches probe by symbol with offset" "kprobe-trigger-$((i+1))" \
255 --name="kprobe-trigger-$((i+1))" \
256 --condition event-rule-matches --type=$type --location="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
257 --action notify
258
259 test_success "--condition event-rule-matches probe by address" "kprobe-trigger-$((i+2))" \
260 --name="kprobe-trigger-$((i+2))" \
261 --condition event-rule-matches --type=$type --location="0x${channel_enable_addr}" --event-name=my_channel_enable \
262 --action notify
263 i=$((i+3))
264 done
265 }
266
267 skip $ist_root "non-root user: skipping uprobe tests" 6 || {
268 test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \
269 --name="uprobe-trigger-0" \
270 --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \
271 --action notify
272
273 test_success "--condition event-rule-matches uprobe with elf prefix" "uprobe-trigger-1" \
274 --name="uprobe-trigger-1" \
275 --condition event-rule-matches --type=kernel:uprobe --location=elf:${uprobe_elf_binary}:test_function --event-name=ma-probe-2 \
276 --action notify
277 }
278
279 skip $ist_root "non-root user: skipping syscall tests" 30 || {
280 test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \
281 --name="syscall-trigger-0" \
282 --condition event-rule-matches --type=syscall --name=open \
283 --action notify
284
285 test_success "--condition event-rule-matches all syscalls" "syscall-trigger-1" \
286 --name="syscall-trigger-1" \
287 --condition event-rule-matches --type=syscall \
288 --action notify
289
290 test_success "--condition event-rule-matches one syscall with filter" "syscall-trigger-2" \
291 --name="syscall-trigger-2" \
292 --condition event-rule-matches --type=syscall --filter 'a > 2' --name=open \
293 --action notify
294 test_success "--condition event-rule-matches one syscall:entry" "syscall-trigger-3" \
295 --name="syscall-trigger-3" \
296 --condition event-rule-matches --type=syscall:entry --name=open \
297 --action notify
298 test_success "--condition event-rule-matches one syscall:exit" "syscall-trigger-4" \
299 --name="syscall-trigger-4" \
300 --condition event-rule-matches --type=syscall:exit --name=open \
301 --action notify
302 test_success "--condition event-rule-matches one syscall:entry-exit" "syscall-trigger-5" \
303 --name="syscall-trigger-5" \
304 --condition event-rule-matches --type=syscall:entry+exit --name=open \
305 --action notify
306
307 # Same thing but with "kernel:syscall" type instead:
308 test_success "--condition event-rule-matches one syscall" "syscall-trigger-6" \
309 --name="syscall-trigger-6" \
310 --condition event-rule-matches --type=kernel:syscall --name=open \
311 --action notify
312
313 test_success "--condition event-rule-matches one kernel:syscall:entry" "syscall-trigger-7" \
314 --name="syscall-trigger-7" \
315 --condition event-rule-matches --type=kernel:syscall:entry --name=open \
316 --action notify
317 test_success "--condition event-rule-matches one kernel:syscall:exit" "syscall-trigger-8" \
318 --name="syscall-trigger-8" \
319 --condition event-rule-matches --type=kernel:syscall:exit --name=open \
320 --action notify
321 test_success "--condition event-rule-matches one kernel:syscall:entry-exit" "syscall-trigger-9" \
322 --name="syscall-trigger-9" \
323 --condition event-rule-matches --type=kernel:syscall:entry+exit --name=open \
324 --action notify
325
326 }
327
328 # `--action notify` successes
329 test_success "--action notify" "notify-1" \
330 --name=notify-1 \
331 --condition event-rule-matches --type=user \
332 --action notify
333
334 test_success "--action notify --capture foo" "notify-2" \
335 --name=notify-2 \
336 --condition event-rule-matches --type=user \
337 --capture foo --action notify
338
339 test_success "--action notify --capture foo[2]" "notify-3" \
340 --name=notify-3 \
341 --condition event-rule-matches --type=user \
342 --capture 'foo[2]' --action notify
343
344 test_success '--action notify --capture $ctx.foo' "notify-4" \
345 --name=notify-4 \
346 --condition event-rule-matches --type=user \
347 --capture '$ctx.foo' --action notify
348
349 test_success '--action notify --capture $ctx.foo[2]' "notify-5" \
350 --name=notify-5 \
351 --condition event-rule-matches --type=user \
352 --capture '$ctx.foo[2]' --action notify
353
354 test_success '--action notify --capture $app.prov:type' "notify-6" \
355 --name=notify-6 \
356 --condition event-rule-matches --type=user \
357 --capture '$app.prov:type' --action notify
358
359 test_success '--action notify --capture $app.prov:type[2]' "notify-7" \
360 --name=notify-7 \
361 --condition event-rule-matches --type=user \
362 --capture '$app.prov:type[2]' --action notify
363
364 test_success '--action notify multiple captures' "notify-8" \
365 --name=notify-8 \
366 --condition event-rule-matches --type=user \
367 --capture foo --capture '$app.hello:world' --action notify
368
369 # `--action start-session` successes
370 test_success "--action start-session" "notify-9" \
371 --name=notify-9 \
372 --condition event-rule-matches --type=user \
373 --action start-session ze-session
374
375 # `--action stop-session` successes
376 test_success "--action stop-session foo" "notify-10"\
377 --name=notify-10 \
378 --condition event-rule-matches --type=user \
379 --action stop-session ze-session
380
381 # `--action rotate-session` successes
382 test_success "--action rotate-session foo" "notify-11"\
383 --name=notify-11 \
384 --condition event-rule-matches --type=user \
385 --action rotate-session ze-session
386
387 # `--action snapshot-session` successes
388 test_success "--action snapshot-session foo" "notify-12"\
389 --name=notify-12 \
390 --condition event-rule-matches --type=user \
391 --action snapshot-session ze-session
392
393 test_success "--action snapshot-session with file URI" "notify-13"\
394 --name=notify-13 \
395 --condition event-rule-matches --type=user \
396 --action snapshot-session ze-session --path /hello
397
398 test_success "--action snapshot-session with net URI" "notify-14"\
399 --name=notify-14 \
400 --condition event-rule-matches --type=user \
401 --action snapshot-session ze-session --url net://1.2.3.4
402
403 test_success "--action snapshot-session with ctrl/data URIs" "notify-15"\
404 --name=notify-15 \
405 --condition event-rule-matches --type=user \
406 --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1234 --data-url=tcp://1.2.3.4:1235
407
408 # top-level failures
409 test_failure "no args" "Error: Missing --condition."
410
411 test_failure "unknown option" \
412 "Error: While parsing argument #2 (\`--hello\`): Unknown option \`--hello\`" \
413 --hello
414
415 test_failure "missing --action" \
416 "Error: Need at least one --action." \
417 --condition event-rule-matches --type=user
418
419 test_failure "two --condition" \
420 "Error: A --condition was already given." \
421 --condition event-rule-matches --name=aaa --type=user \
422 --condition event-rule-matches --name=bbb --type=user \
423 --action notify
424
425 test_failure "missing argument to --name" \
426 "Error: While parsing argument #2 (\`--name\`): Missing required argument for option \`--name\`" \
427 --name
428
429 for cmd in rate-policy=once-after rate-policy=every; do
430 test_failure "missing argument to --${cmd}" \
431 "Error: Rate policy format is invalid." \
432 --condition event-rule-matches --type=user --action notify \
433 --${cmd}
434
435 test_failure "invalid argument to --${cmd}: non-digit character" \
436 "Error: Failed to parse rate policy value \`123bob\` as an integer." \
437 --condition event-rule-matches --type=user --action notify \
438 --${cmd}:123bob
439
440 test_failure "invalid argument to --${cmd}: empty string" \
441 "Error: Failed to parse rate policy value \`\` as an integer." \
442 --condition event-rule-matches --type=user --action notify \
443 --${cmd}":"
444 done
445
446 test_failure "invalid argument to --rate-policy: unknown policy type" \
447 "Error: Rate policy type \`bob\` unknown." \
448 --condition event-rule-matches --type=user --action notify \
449 --rate-policy=bob:123
450
451 # `--condition` failures
452 test_failure "missing args after --condition" \
453 "Error: While parsing argument #2 (\`--condition\`): Missing required argument for option \`--condition\`
454 Error: Valid condition names are:
455 Error: event-rule-matches" \
456 --condition
457 test_failure "unknown --condition" \
458 "Error: While parsing argument #2 (\`--condition\`): Unknown condition name 'zoofest'
459 Error: Valid condition names are:
460 Error: event-rule-matches" \
461 --condition zoofest
462 test_failure "unknown --condition=" \
463 "Error: While parsing argument #2 (\`--condition=zoofest\`): Unknown condition name 'zoofest'
464 Error: Valid condition names are:
465 Error: event-rule-matches" \
466 --condition=zoofest
467
468 # `--condition event-rule-matches` failures
469 test_failure "missing args after --condition event-rule-matches" \
470 "Error: Need at least one --action." \
471 --condition event-rule-matches --type=user
472
473 test_failure "extra args after --condition event-rule-matches" \
474 "Error: Unexpected argument 'bozo'" \
475 --condition event-rule-matches --type=user bozo
476
477 test_failure "--log-level unknown level" \
478 "Error: Failed to parse log level string \`FOO\`." \
479 --condition event-rule-matches --type=user --log-level=FOO
480
481 for type in kprobe kernel:kprobe; do
482 test_failure "--condition event-rule-matches: --name with --type=$type" \
483 "Error: Can't use --name with kernel kprobe event rules." \
484 --condition event-rule-matches --type=$type --location=do_sys_open --name='hello'
485 done
486
487 test_failure "--condition event-rule-matches: --location with user tracepoint event rule" \
488 "Error: Can't use --location with user tracepoint event rules." \
489 --condition event-rule-matches --type=user --location='hello'
490
491 test_failure "--condition event-rule-matches: --event-name with user tracepoint event rule" \
492 "Error: Can't use --event-name with user tracepoint event rules." \
493 --condition event-rule-matches --type=user --event-name='hello'
494
495 test_failure "--condition event-rule-matches: extra argument with --type=kernel:uprobe" \
496 "Error: Unexpected argument 'hello'" \
497 --condition event-rule-matches --type=$type --location=${uprobe_elf_binary}:test_failure hello
498
499 test_failure "--condition event-rule-matches: extra argument with --type=syscall" \
500 "Error: Unexpected argument 'open'" \
501 --condition event-rule-matches --type=syscall open
502
503 test_failure "--condition event-rule-matches: --type=syscall:nope" \
504 "Error: Failed to parse syscall type 'syscall:nope'." \
505 --condition event-rule-matches --type=syscall:nope \
506 --name=open
507
508 test_failure "--exclude-name with non-glob name" \
509 "Error: Event jean: Exclusions can only be used with a globbing pattern" \
510 --condition event-rule-matches --type=user --name='jean' --exclude-name jean-chretien \
511 --action notify
512
513 test_failure "--condition event-rule-matches --capture: missing argument (end of arg list)" \
514 'Error: While parsing argument #7 (`--capture`): Missing required argument for option `--capture`' \
515 --action notify \
516 --condition event-rule-matches --type=user --capture
517
518 test_failure "--condition event-rule-matches --capture: missing argument (before another option)" \
519 'Error: While parsing expression `--action`: Unary operators are not allowed in capture expressions.' \
520 --condition event-rule-matches --type=user --capture \
521 --action notify \
522
523 test_failure "--condition event-rule-matches --capture: binary operator" \
524 'Error: While parsing expression `foo == 2`: Binary operators are not allowed in capture expressions.' \
525 --condition event-rule-matches --type=user \
526 --capture 'foo == 2' --action notify
527
528 test_failure "--condition event-rule-matches --capture: unary operator" \
529 'Error: While parsing expression `!foo`: Unary operators are not allowed in capture expressions.' \
530 --condition event-rule-matches --type=user \
531 --capture '!foo' --action notify
532
533 test_failure "--condition event-rule-matches --capture: logical operator" \
534 'Error: While parsing expression `foo || bar`: Logical operators are not allowed in capture expressions.' \
535 --condition event-rule-matches --type=user \
536 --capture 'foo || bar' --action notify
537
538 test_failure "--condition event-rule-matches --capture: accessing a sub-field" \
539 'Error: While parsing expression `foo.bar`: Capturing subfields is not supported.' \
540 --condition event-rule-matches --type=user \
541 --capture 'foo.bar' --action notify
542
543 test_failure "--condition event-rule-matches --capture: accessing the sub-field of an array element" \
544 'Error: While parsing expression `foo[3].bar`: Capturing subfields is not supported.' \
545 --condition event-rule-matches --type=user \
546 --capture 'foo[3].bar' --action notify
547
548 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
549 'Error: Invalid app-specific context field name: missing colon in `foo`.' \
550 --condition event-rule-matches --type=user \
551 --capture '$app.foo' --action notify
552
553 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
554 'Error: Invalid app-specific context field name: missing type name after colon in `foo:`.' \
555 --condition event-rule-matches --type=user \
556 --capture '$app.foo:' --action notify
557
558 # `--action` failures
559 test_failure "missing args after --action" \
560 "Error: While parsing argument #5 (\`--action\`): Missing required argument for option \`--action\`
561 Error: Valid action names are:
562 Error: notify" \
563 --condition event-rule-matches --type=user \
564 --action
565
566 test_failure "unknown --action" \
567 "Error: While parsing argument #5 (\`--action\`): Unknown action name 'zoofest'
568 Error: Valid action names are:
569 Error: notify" \
570 --condition event-rule-matches --type=user \
571 --action zoofest
572
573 test_failure "unknown --action=" \
574 "Error: While parsing argument #5 (\`--action=zoofest\`): Unknown action name 'zoofest'
575 Error: Valid action names are:
576 Error: notify" \
577 --condition event-rule-matches --type=user \
578 --action=zoofest
579
580 # `--action notify` failures
581 test_failure "extra arg after --action notify" \
582 "Error: Unexpected argument \`bob\`." \
583 --condition event-rule-matches --type=user \
584 --action notify bob
585
586 # `--action start-session` failures
587 test_failure "missing arg after --action start-session" \
588 "Error: Missing session name." \
589 --condition event-rule-matches --type=user \
590 --action start-session
591 test_failure "extra arg after --action start-session" \
592 "Error: Unexpected argument \`bob\`." \
593 --condition event-rule-matches --type=user \
594 --action start-session ze-session bob
595
596 # `--action stop-session` failures
597 test_failure "missing arg after --action stop-session" \
598 "Error: Missing session name." \
599 --condition event-rule-matches --type=user \
600 --action stop-session
601 test_failure "extra arg after --action stop-session" \
602 "Error: Unexpected argument \`bob\`." \
603 --condition event-rule-matches --type=user \
604 --action stop-session ze-session bob
605
606 # `--action rotate-session` failures
607 test_failure "missing arg after --action rotate-session" \
608 "Error: Missing session name." \
609 --condition event-rule-matches --type=user \
610 --action rotate-session
611 test_failure "extra arg after --action rotate-session" \
612 "Error: Unexpected argument \`bob\`." \
613 --condition event-rule-matches --type=user \
614 --action rotate-session ze-session bob
615
616 # `--action snapshot-session` failures
617 test_failure "missing arg after --action snapshot-session" \
618 "Error: Missing session name." \
619 --condition event-rule-matches --type=user \
620 --action snapshot-session
621 test_failure "extra arg after --action snapshot-session" \
622 "Error: Unexpected argument \`bob\`." \
623 --condition event-rule-matches --type=user \
624 --action snapshot-session ze-session bob
625 test_failure "snapshot-session action, --max-size without destination" \
626 "Error: Can't provide a snapshot output max size without a snapshot output destination." \
627 --condition event-rule-matches --type=user \
628 --action snapshot-session ze-session --max-size 10M
629 test_failure "snapshot-session action, --name without destination" \
630 "Error: Can't provide a snapshot output name without a snapshot output destination." \
631 --condition event-rule-matches --type=user \
632 --action snapshot-session ze-session --name hallo
633 test_failure "snapshot-session action, --name with-local-path-instead-of-url" \
634 "Error: Failed to parse '/something/that/looks/like/a/path' as an URL." \
635 --condition event-rule-matches --type=user \
636 --action snapshot-session ze-session --name hallo --url /something/that/looks/like/a/path
637 test_failure "snapshot-session action, --name with-net-url-instead-of-path" \
638 "Error: Failed to parse 'net://8.8.8.8/' as a local path." \
639 --condition event-rule-matches --type=user \
640 --action snapshot-session ze-session --name hallo --path net://8.8.8.8/
641
642 test_mi
643
644 # Cleanup
645 stop_lttng_sessiond_notap
646 rm -f "${tmp_stdout}"
647 rm -f "${tmp_stderr}"
This page took 0.042923 seconds and 4 git commands to generate.