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