| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) - 2012 David Goulet <dgoulet@efficios.com> |
| 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 | TEST_DESC="UST - Wildcard overlap" |
| 18 | |
| 19 | CURDIR=$(dirname $0)/ |
| 20 | TESTDIR=$CURDIR/../.. |
| 21 | SESSION_NAME="wildcard-overlap" |
| 22 | |
| 23 | DEMO_EVENT1="ust_tests_demo:starting" |
| 24 | DEMO_EVENT1_2="ust_tests_demo:done" |
| 25 | DEMO_EVENT2="ust_tests_demo2:loop" |
| 26 | DEMO_EVENT3="ust_tests_demo3:done" |
| 27 | |
| 28 | NUM_DEMO1_EVENT=1 |
| 29 | NUM_DEMO1_2_EVENT=1 |
| 30 | NUM_DEMO2_EVENT=5 |
| 31 | NUM_DEMO3_EVENT=1 |
| 32 | |
| 33 | source $TESTDIR/utils.sh |
| 34 | |
| 35 | print_test_banner "$TEST_DESC" |
| 36 | |
| 37 | if [ ! -x "$CURDIR/demo/demo" ]; then |
| 38 | echo -e "No UST nevents binary detected. Passing." |
| 39 | exit 0 |
| 40 | fi |
| 41 | |
| 42 | # MUST set TESTDIR before calling those functions |
| 43 | |
| 44 | run_demo_app() |
| 45 | { |
| 46 | local dir=`pwd` |
| 47 | |
| 48 | cd demo |
| 49 | |
| 50 | # Start test |
| 51 | echo -n "Starting application... " |
| 52 | ./$CURDIR/demo-trace >/dev/null 2>&1 |
| 53 | echo -n "Ended " |
| 54 | print_ok |
| 55 | |
| 56 | cd $dir |
| 57 | } |
| 58 | |
| 59 | # Ease our life a bit ;) |
| 60 | trace_match_demo1_events() |
| 61 | { |
| 62 | trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH |
| 63 | trace_matches $DEMO_EVENT1_2 $NUM_DEMO1_EVENT $TRACE_PATH |
| 64 | } |
| 65 | |
| 66 | # Ease our life a bit ;) |
| 67 | trace_match_all_demo_events() |
| 68 | { |
| 69 | trace_match_demo1_events |
| 70 | trace_matches $DEMO_EVENT2 $NUM_DEMO2_EVENT $TRACE_PATH |
| 71 | trace_matches $DEMO_EVENT3 $NUM_DEMO3_EVENT $TRACE_PATH |
| 72 | } |
| 73 | |
| 74 | # Ease our life a bit ;) |
| 75 | trace_match_no_demo_events() |
| 76 | { |
| 77 | trace_matches $DEMO_EVENT1 0 $TRACE_PATH |
| 78 | trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH |
| 79 | trace_matches $DEMO_EVENT2 0 $TRACE_PATH |
| 80 | trace_matches $DEMO_EVENT3 0 $TRACE_PATH |
| 81 | } |
| 82 | |
| 83 | # Expect all "demo" events, no duplicate. |
| 84 | test_enable_simple_wildcard() |
| 85 | { |
| 86 | local event_wild1="us*" |
| 87 | local event_wild2="ust*" |
| 88 | |
| 89 | echo "" |
| 90 | echo "=== Simple wildcard overlap" |
| 91 | |
| 92 | enable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 93 | enable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 94 | |
| 95 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 96 | |
| 97 | run_demo_app |
| 98 | |
| 99 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 100 | |
| 101 | trace_match_all_demo_events |
| 102 | |
| 103 | return $? |
| 104 | } |
| 105 | |
| 106 | # Expect all "demo" events, no duplicate. |
| 107 | test_enable_wildcard_filter() |
| 108 | { |
| 109 | local event_wild1="us*" |
| 110 | local event_wild2="ust*" |
| 111 | |
| 112 | echo "" |
| 113 | echo "=== Wildcard overlap with filter" |
| 114 | |
| 115 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 116 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 117 | |
| 118 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 119 | |
| 120 | run_demo_app |
| 121 | |
| 122 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 123 | |
| 124 | trace_match_all_demo_events |
| 125 | return $? |
| 126 | } |
| 127 | |
| 128 | # Expect all "demo" events, no duplicate. |
| 129 | test_enable_wildcard_filter_2() |
| 130 | { |
| 131 | local event_wild1="us*" |
| 132 | local event_wild2="ust*" |
| 133 | |
| 134 | echo "" |
| 135 | echo "=== Wildcard overlap with filter 2" |
| 136 | |
| 137 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==0" |
| 138 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 139 | |
| 140 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 141 | |
| 142 | run_demo_app |
| 143 | |
| 144 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 145 | |
| 146 | trace_match_all_demo_events |
| 147 | return $? |
| 148 | } |
| 149 | |
| 150 | # Expect all "demo" events, no duplicate. |
| 151 | test_enable_wildcard_filter_3() |
| 152 | { |
| 153 | local event_wild1="us*" |
| 154 | local event_wild2="ust*" |
| 155 | |
| 156 | echo "" |
| 157 | echo "=== Wildcard overlap with filter 3" |
| 158 | |
| 159 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 160 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 161 | |
| 162 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 163 | |
| 164 | run_demo_app |
| 165 | |
| 166 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 167 | |
| 168 | trace_match_all_demo_events |
| 169 | return $? |
| 170 | } |
| 171 | |
| 172 | # Expected: No events. |
| 173 | test_enable_wildcard_filter_4() |
| 174 | { |
| 175 | local event_wild1="us*" |
| 176 | local event_wild2="ust*" |
| 177 | |
| 178 | echo "" |
| 179 | echo "=== Wildcard overlap with filter 4" |
| 180 | |
| 181 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==0" |
| 182 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 183 | |
| 184 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 185 | |
| 186 | run_demo_app |
| 187 | |
| 188 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 189 | |
| 190 | trace_match_no_demo_events |
| 191 | return $? |
| 192 | } |
| 193 | |
| 194 | # Expect all "demo" events, no duplicate. |
| 195 | test_enable_wildcard_filter_5() |
| 196 | { |
| 197 | local event_wild1="us*" |
| 198 | local event_wild2="$DEMO_EVENT1" |
| 199 | |
| 200 | echo "" |
| 201 | echo "=== Wildcard overlap with filter 5" |
| 202 | |
| 203 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 204 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 205 | |
| 206 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 207 | |
| 208 | run_demo_app |
| 209 | |
| 210 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 211 | |
| 212 | trace_match_all_demo_events |
| 213 | return $? |
| 214 | } |
| 215 | |
| 216 | # Expect all $DEMO_EVENT1 events, no duplicate. |
| 217 | test_enable_wildcard_filter_6() |
| 218 | { |
| 219 | local event_wild1="us*" |
| 220 | local event_wild2="$DEMO_EVENT1" |
| 221 | |
| 222 | echo "" |
| 223 | echo "=== Wildcard overlap with filter 6" |
| 224 | |
| 225 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==0" |
| 226 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 227 | |
| 228 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 229 | |
| 230 | run_demo_app |
| 231 | |
| 232 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 233 | |
| 234 | trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH |
| 235 | trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH |
| 236 | trace_matches $DEMO_EVENT2 0 $TRACE_PATH |
| 237 | trace_matches $DEMO_EVENT3 0 $TRACE_PATH |
| 238 | return $? |
| 239 | } |
| 240 | |
| 241 | # Expect all events, no duplicate. |
| 242 | test_enable_wildcard_filter_7() |
| 243 | { |
| 244 | local event_wild1="us*" |
| 245 | local event_wild2="$DEMO_EVENT1" |
| 246 | |
| 247 | echo "" |
| 248 | echo "=== Wildcard overlap with filter 7" |
| 249 | |
| 250 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 251 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 252 | |
| 253 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 254 | |
| 255 | run_demo_app |
| 256 | |
| 257 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 258 | |
| 259 | trace_match_all_demo_events |
| 260 | return $? |
| 261 | } |
| 262 | |
| 263 | # Expected: No events. |
| 264 | test_enable_wildcard_filter_8() |
| 265 | { |
| 266 | local event_wild1="us*" |
| 267 | local event_wild2="$DEMO_EVENT1" |
| 268 | |
| 269 | echo "" |
| 270 | echo "=== Wildcard overlap with filter 8" |
| 271 | |
| 272 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==0" |
| 273 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 274 | |
| 275 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 276 | |
| 277 | run_demo_app |
| 278 | |
| 279 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 280 | |
| 281 | trace_match_no_demo_events |
| 282 | return $? |
| 283 | } |
| 284 | |
| 285 | # Expect all events. |
| 286 | test_enable_same_wildcard_filter() |
| 287 | { |
| 288 | local event_wild1="ust*" |
| 289 | local event_wild2="ust*" |
| 290 | |
| 291 | echo "" |
| 292 | echo "=== Same wildcard overlap with filter" |
| 293 | |
| 294 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1&&1==1" |
| 295 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 296 | |
| 297 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 298 | |
| 299 | run_demo_app |
| 300 | |
| 301 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 302 | |
| 303 | trace_match_all_demo_events |
| 304 | return $? |
| 305 | } |
| 306 | |
| 307 | # Expect all events. |
| 308 | test_enable_same_wildcard_filter_2() |
| 309 | { |
| 310 | local event_wild1="ust*" |
| 311 | local event_wild2="ust*" |
| 312 | |
| 313 | echo "" |
| 314 | echo "=== Same wildcard overlap with filter 2" |
| 315 | |
| 316 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 317 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 318 | |
| 319 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 320 | |
| 321 | run_demo_app |
| 322 | |
| 323 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 324 | |
| 325 | trace_match_all_demo_events |
| 326 | return $? |
| 327 | } |
| 328 | |
| 329 | # Expect all events. |
| 330 | test_enable_same_wildcard_filter_3() |
| 331 | { |
| 332 | local event_wild1="ust*" |
| 333 | local event_wild2="ust*" |
| 334 | |
| 335 | echo "" |
| 336 | echo "=== Same wildcard overlap with filter 3" |
| 337 | |
| 338 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1" |
| 339 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 340 | |
| 341 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 342 | |
| 343 | run_demo_app |
| 344 | |
| 345 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 346 | |
| 347 | trace_match_all_demo_events |
| 348 | return $? |
| 349 | } |
| 350 | |
| 351 | # Expected: No events. |
| 352 | test_enable_same_wildcard_filter_4() |
| 353 | { |
| 354 | local event_wild1="ust*" |
| 355 | local event_wild2="ust*" |
| 356 | |
| 357 | echo "" |
| 358 | echo "=== Same wildcard overlap with filter 4" |
| 359 | |
| 360 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==0&&1==0" |
| 361 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==0" |
| 362 | |
| 363 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 364 | |
| 365 | run_demo_app |
| 366 | |
| 367 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 368 | |
| 369 | trace_match_no_demo_events |
| 370 | return $? |
| 371 | } |
| 372 | |
| 373 | # Expected: Only $DEMO_EVENT1 |
| 374 | test_enable_same_event_filter() |
| 375 | { |
| 376 | local event_wild1="$DEMO_EVENT1" |
| 377 | local event_wild2="$DEMO_EVENT1" |
| 378 | |
| 379 | echo "" |
| 380 | echo "=== Enable same event with filter." |
| 381 | |
| 382 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1&&1==1" |
| 383 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 384 | |
| 385 | disable_ust_lttng_event $SESSION_NAME "ust*" |
| 386 | |
| 387 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 388 | |
| 389 | run_demo_app |
| 390 | |
| 391 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 392 | |
| 393 | trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH |
| 394 | trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH |
| 395 | trace_matches $DEMO_EVENT2 0 $TRACE_PATH |
| 396 | trace_matches $DEMO_EVENT3 0 $TRACE_PATH |
| 397 | return $? |
| 398 | } |
| 399 | |
| 400 | # Expected: No events. |
| 401 | test_disable_same_wildcard_filter() |
| 402 | { |
| 403 | local event_wild1="ust*" |
| 404 | local event_wild2="ust*" |
| 405 | |
| 406 | echo "" |
| 407 | echo "=== Disable same wildcard with filter." |
| 408 | |
| 409 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild1 "1==1&&1==1" |
| 410 | enable_ust_lttng_event_filter $SESSION_NAME $event_wild2 "1==1" |
| 411 | |
| 412 | disable_ust_lttng_event $SESSION_NAME "ust*" |
| 413 | |
| 414 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 415 | |
| 416 | run_demo_app |
| 417 | |
| 418 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 419 | |
| 420 | trace_match_no_demo_events |
| 421 | return $? |
| 422 | } |
| 423 | |
| 424 | # Expect no events |
| 425 | test_enable_bad_wildcard() |
| 426 | { |
| 427 | # Invalid event |
| 428 | local event_wild1="ust_tests_demo" |
| 429 | local event_wild2="ust_tests_demo2" |
| 430 | local event_wild3="ust_tests_demo3" |
| 431 | |
| 432 | echo "" |
| 433 | echo "=== Enable bad wildcard" |
| 434 | |
| 435 | enable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 436 | enable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 437 | enable_ust_lttng_event $SESSION_NAME $event_wild3 |
| 438 | |
| 439 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 440 | |
| 441 | run_demo_app |
| 442 | |
| 443 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 444 | |
| 445 | trace_match_no_demo_events |
| 446 | return $? |
| 447 | } |
| 448 | |
| 449 | # Expect all "demo" events, no duplicate. |
| 450 | test_enable_simple_wildcard_2() |
| 451 | { |
| 452 | local event_wild1="us*" |
| 453 | local event_wild2="$DEMO_EVENT1" |
| 454 | |
| 455 | echo "" |
| 456 | echo "=== Simple wildcard 2" |
| 457 | |
| 458 | enable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 459 | enable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 460 | |
| 461 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 462 | |
| 463 | run_demo_app |
| 464 | |
| 465 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 466 | |
| 467 | trace_match_all_demo_events |
| 468 | return $? |
| 469 | } |
| 470 | |
| 471 | # Expected: all CRIT events, + all warning events. |
| 472 | test_enable_loglevel_overlap() |
| 473 | { |
| 474 | local event_wild1="us*" |
| 475 | local event_wild2="ust*" |
| 476 | |
| 477 | echo "" |
| 478 | echo "=== Enable loglevel overlap" |
| 479 | |
| 480 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild1" "TRACE_WARNING" |
| 481 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild2" "TRACE_CRIT" |
| 482 | |
| 483 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 484 | |
| 485 | run_demo_app |
| 486 | |
| 487 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 488 | |
| 489 | trace_match_all_demo_events |
| 490 | return $? |
| 491 | } |
| 492 | |
| 493 | # Expected: all CRIT events, + all warning events. |
| 494 | test_enable_loglevel_only_overlap() |
| 495 | { |
| 496 | local event_wild1="us*" |
| 497 | local event_wild2="ust*" |
| 498 | |
| 499 | echo "" |
| 500 | echo "=== Enable loglevel only overlap" |
| 501 | |
| 502 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild1" "TRACE_WARNING" |
| 503 | enable_ust_lttng_event_loglevel_only $SESSION_NAME "$event_wild2" "TRACE_CRIT" |
| 504 | |
| 505 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 506 | |
| 507 | run_demo_app |
| 508 | |
| 509 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 510 | |
| 511 | trace_match_all_demo_events |
| 512 | return $? |
| 513 | } |
| 514 | |
| 515 | # Expected: all events |
| 516 | test_enable_loglevel_overlap_2() |
| 517 | { |
| 518 | local event_wild1="us*" |
| 519 | local event_wild2="$DEMO_EVENT2" |
| 520 | |
| 521 | echo "" |
| 522 | echo "=== Enable loglevel overlap 2" |
| 523 | |
| 524 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild1" "TRACE_WARNING" |
| 525 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild2" "TRACE_CRIT" |
| 526 | |
| 527 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 528 | |
| 529 | run_demo_app |
| 530 | |
| 531 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 532 | |
| 533 | trace_match_all_demo_events |
| 534 | return $? |
| 535 | } |
| 536 | |
| 537 | # Expected only ust_tests_demo* events. |
| 538 | test_enable_same_wildcard_loglevels() |
| 539 | { |
| 540 | local event_wild1="ust*" |
| 541 | local event_wild2="ust*" |
| 542 | |
| 543 | echo "" |
| 544 | echo "=== Enable same wildcard with different loglevels" |
| 545 | |
| 546 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild1" "TRACE_CRIT" |
| 547 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild2" "TRACE_WARNING" |
| 548 | |
| 549 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 550 | |
| 551 | run_demo_app |
| 552 | |
| 553 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 554 | |
| 555 | trace_match_all_demo_events |
| 556 | return $? |
| 557 | } |
| 558 | |
| 559 | # Expected only ust_tests_demo:starting events. |
| 560 | test_enable_same_event_loglevels() |
| 561 | { |
| 562 | local event_wild1="$DEMO_EVENT1" |
| 563 | local event_wild2="$DEMO_EVENT1" |
| 564 | |
| 565 | echo "" |
| 566 | echo "=== Enable same event with different loglevels" |
| 567 | |
| 568 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild1" "TRACE_CRIT" |
| 569 | enable_ust_lttng_event_loglevel $SESSION_NAME "$event_wild2" "TRACE_WARNING" |
| 570 | |
| 571 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 572 | |
| 573 | run_demo_app |
| 574 | |
| 575 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 576 | |
| 577 | trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH |
| 578 | trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH |
| 579 | trace_matches $DEMO_EVENT2 0 $TRACE_PATH |
| 580 | trace_matches $DEMO_EVENT3 0 $TRACE_PATH |
| 581 | return $? |
| 582 | } |
| 583 | |
| 584 | # Expect 0 event |
| 585 | test_disable_simple_wildcard() |
| 586 | { |
| 587 | local event_wild1="us*" |
| 588 | local event_wild2="$DEMO_EVENT1" |
| 589 | |
| 590 | echo "" |
| 591 | echo "=== Disable simple wildcard" |
| 592 | |
| 593 | enable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 594 | enable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 595 | |
| 596 | disable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 597 | disable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 598 | |
| 599 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 600 | |
| 601 | run_demo_app |
| 602 | |
| 603 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 604 | |
| 605 | # No events are expected. |
| 606 | trace_match_no_demo_events |
| 607 | return $? |
| 608 | } |
| 609 | |
| 610 | # Expect only "ust_tests_demo" events. |
| 611 | test_disable_wildcard_overlap() |
| 612 | { |
| 613 | local event_wild1="us*" |
| 614 | local event_wild2="$DEMO_EVENT1" |
| 615 | |
| 616 | echo "" |
| 617 | echo "=== Disable wildcard overlap" |
| 618 | |
| 619 | enable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 620 | enable_ust_lttng_event $SESSION_NAME $event_wild2 |
| 621 | |
| 622 | disable_ust_lttng_event $SESSION_NAME $event_wild1 |
| 623 | |
| 624 | start_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 625 | |
| 626 | run_demo_app |
| 627 | |
| 628 | stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1 |
| 629 | |
| 630 | # Expect only "ust_tests_demo" events. |
| 631 | trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH |
| 632 | trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH |
| 633 | trace_matches $DEMO_EVENT2 0 $TRACE_PATH |
| 634 | trace_matches $DEMO_EVENT3 0 $TRACE_PATH |
| 635 | return $? |
| 636 | } |
| 637 | |
| 638 | TESTS=( |
| 639 | "test_enable_wildcard_filter" |
| 640 | "test_enable_wildcard_filter_2" |
| 641 | "test_enable_wildcard_filter_3" |
| 642 | "test_enable_wildcard_filter_4" |
| 643 | "test_enable_wildcard_filter_5" |
| 644 | "test_enable_wildcard_filter_6" |
| 645 | "test_enable_wildcard_filter_7" |
| 646 | "test_enable_wildcard_filter_8" |
| 647 | "test_enable_same_wildcard_filter" |
| 648 | "test_enable_same_wildcard_filter_2" |
| 649 | "test_enable_same_wildcard_filter_3" |
| 650 | "test_enable_same_wildcard_filter_4" |
| 651 | "test_enable_same_event_filter" |
| 652 | "test_enable_loglevel_only_overlap" |
| 653 | "test_enable_same_event_loglevels" |
| 654 | "test_enable_same_wildcard_loglevels" |
| 655 | "test_enable_bad_wildcard" |
| 656 | "test_enable_loglevel_overlap_2" |
| 657 | "test_enable_simple_wildcard" |
| 658 | "test_enable_simple_wildcard_2" |
| 659 | "test_enable_loglevel_overlap" |
| 660 | "test_disable_simple_wildcard" |
| 661 | "test_disable_wildcard_overlap" |
| 662 | ) |
| 663 | |
| 664 | TEST_COUNT=${#TESTS[@]} |
| 665 | i=0 |
| 666 | |
| 667 | start_lttng_sessiond |
| 668 | |
| 669 | while [ "$i" -lt "$TEST_COUNT" ]; do |
| 670 | |
| 671 | TRACE_PATH=$(mktemp -d) |
| 672 | |
| 673 | create_lttng_session $SESSION_NAME $TRACE_PATH >/dev/null 2>&1 |
| 674 | |
| 675 | # Execute test |
| 676 | ${TESTS[$i]} |
| 677 | if [ $? -ne 0 ]; then |
| 678 | stop_lttng_sessiond |
| 679 | exit 1 |
| 680 | fi |
| 681 | |
| 682 | destroy_lttng_session $SESSION_NAME >/dev/null 2>&1 |
| 683 | |
| 684 | rm -rf $TRACE_PATH |
| 685 | |
| 686 | let "i++" |
| 687 | done |
| 688 | |
| 689 | stop_lttng_sessiond |