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