| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com> |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify it |
| 6 | # under the terms of the GNU General Public License, version 2 only, as |
| 7 | # published by the Free Software Foundation. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | # more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License along with |
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 |
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | |
| 18 | TEST_DESC="Filtering - Valid filters" |
| 19 | |
| 20 | CURDIR=$(dirname $0)/ |
| 21 | TESTDIR=$CURDIR/../../.. |
| 22 | LTTNG_BIN="lttng" |
| 23 | STATS_BIN="$TESTDIR/utils/babelstats.pl" |
| 24 | SESSION_NAME="valid_filter" |
| 25 | NR_ITER=100 |
| 26 | NUM_GLOBAL_TESTS=2 |
| 27 | NUM_UST_TESTS=288 |
| 28 | NUM_KERNEL_TESTS=288 |
| 29 | NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS)) |
| 30 | |
| 31 | source $TESTDIR/utils/utils.sh |
| 32 | |
| 33 | function enable_lttng_event_filter() |
| 34 | { |
| 35 | domain="$1" |
| 36 | sess_name="$2" |
| 37 | event_name="$3" |
| 38 | filter="$4" |
| 39 | |
| 40 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name \ |
| 41 | -s $sess_name $domain --filter "$filter" 2>&1 >/dev/null |
| 42 | $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-context \ |
| 43 | -s $sess_name $domain -t procname 2>&1 >/dev/null |
| 44 | |
| 45 | ok $? "Enable lttng event with filtering" |
| 46 | } |
| 47 | |
| 48 | function run_ust |
| 49 | { |
| 50 | ./$CURDIR/$BIN_NAME $NR_ITER >/dev/null 2>&1 |
| 51 | } |
| 52 | |
| 53 | function run_kernel |
| 54 | { |
| 55 | # Trigger the event for 100 iterations |
| 56 | echo -n "100" > /proc/lttng-test-filter-event |
| 57 | } |
| 58 | |
| 59 | function test_valid_filter |
| 60 | { |
| 61 | domain_name="$1" |
| 62 | domain="$2" |
| 63 | event_name="$3" |
| 64 | filter="$4" |
| 65 | validator="$5" |
| 66 | |
| 67 | diag "Test valid $domain_name filter: $filter" |
| 68 | |
| 69 | trace_path=$(mktemp -d) |
| 70 | |
| 71 | # Create session |
| 72 | create_lttng_session_ok $SESSION_NAME $trace_path |
| 73 | |
| 74 | # Enable filter |
| 75 | enable_lttng_event_filter $domain $SESSION_NAME "$event_name" "$filter" |
| 76 | |
| 77 | # Trace apps |
| 78 | start_lttng_tracing_ok $SESSION_NAME |
| 79 | run_$domain_name |
| 80 | stop_lttng_tracing_ok $SESSION_NAME |
| 81 | |
| 82 | # Destroy session |
| 83 | destroy_lttng_session_ok $SESSION_NAME |
| 84 | |
| 85 | stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name` |
| 86 | |
| 87 | rm -rf $trace_path |
| 88 | |
| 89 | $validator "$stats" |
| 90 | |
| 91 | ok $? "Validate trace filter output" |
| 92 | |
| 93 | rm -rf $trace_path |
| 94 | } |
| 95 | |
| 96 | function validate_min_max |
| 97 | { |
| 98 | stats="$1" |
| 99 | field=$2 |
| 100 | expected_min=$3 |
| 101 | expected_max=$4 |
| 102 | |
| 103 | echo $stats | grep -q "$field $expected_min $expected_max" |
| 104 | |
| 105 | return $? |
| 106 | } |
| 107 | |
| 108 | function validator_intfield |
| 109 | { |
| 110 | stats="$1" |
| 111 | status=0 |
| 112 | |
| 113 | validate_min_max "$stats" "intfield" "1" "99" |
| 114 | status=$(($status|$?)) |
| 115 | |
| 116 | validate_min_max "$stats" "intfield2" "0x1" "0x63" |
| 117 | status=$(($status|$?)) |
| 118 | |
| 119 | validate_min_max "$stats" "longfield" "1" "99" |
| 120 | status=$(($status|$?)) |
| 121 | |
| 122 | validate_min_max "$stats" "netintfield" "1" "99" |
| 123 | status=$(($status|$?)) |
| 124 | |
| 125 | validate_min_max "$stats" "netintfieldhex" "0x1" "0x63" |
| 126 | status=$(($status|$?)) |
| 127 | |
| 128 | if [ $KERNEL_CHECK -eq 0 ]; then |
| 129 | validate_min_max "$stats" "floatfield" "2222" "2222" |
| 130 | status=$(($status|$?)) |
| 131 | |
| 132 | validate_min_max "$stats" "doublefield" "2" "2" |
| 133 | status=$(($status|$?)) |
| 134 | fi |
| 135 | |
| 136 | return $status |
| 137 | } |
| 138 | |
| 139 | function validator_intfield_gt |
| 140 | { |
| 141 | stats="$1" |
| 142 | status=0 |
| 143 | |
| 144 | validate_min_max "$stats" "intfield" "2" "99" |
| 145 | status=$(($status|$?)) |
| 146 | |
| 147 | return $status |
| 148 | } |
| 149 | |
| 150 | function validator_has_no_event |
| 151 | { |
| 152 | stats="$1" |
| 153 | status=0 |
| 154 | |
| 155 | validate_min_max "$stats" "intfield" "0" "99" |
| 156 | status=$(($status|$?)) |
| 157 | |
| 158 | if [ $status -eq 0 ]; then |
| 159 | return 1 |
| 160 | else |
| 161 | return 0 |
| 162 | fi |
| 163 | } |
| 164 | |
| 165 | function validator_has_events |
| 166 | { |
| 167 | stats="$1" |
| 168 | status=0 |
| 169 | |
| 170 | validate_min_max "$stats" "intfield" "0" "99" |
| 171 | status=$(($status|$?)) |
| 172 | |
| 173 | return $status |
| 174 | } |
| 175 | |
| 176 | function validator_intfield_ge |
| 177 | { |
| 178 | stats="$1" |
| 179 | status=0 |
| 180 | |
| 181 | validate_min_max "$stats" "intfield" "1" "99" |
| 182 | status=$(($status|$?)) |
| 183 | |
| 184 | return $status |
| 185 | } |
| 186 | |
| 187 | function validator_intfield_lt |
| 188 | { |
| 189 | stats="$1" |
| 190 | status=0 |
| 191 | |
| 192 | validate_min_max "$stats" "intfield" "0" "1" |
| 193 | status=$(($status|$?)) |
| 194 | |
| 195 | return $status |
| 196 | } |
| 197 | |
| 198 | function validator_intfield_le |
| 199 | { |
| 200 | stats="$1" |
| 201 | status=0 |
| 202 | |
| 203 | validate_min_max "$stats" "intfield" "0" "2" |
| 204 | status=$(($status|$?)) |
| 205 | |
| 206 | return $status |
| 207 | } |
| 208 | |
| 209 | function validator_intfield_eq |
| 210 | { |
| 211 | stats="$1" |
| 212 | status=0 |
| 213 | |
| 214 | validate_min_max "$stats" "intfield" "1" "1" |
| 215 | status=$(($status|$?)) |
| 216 | |
| 217 | return $status |
| 218 | } |
| 219 | |
| 220 | function validator_intfield_ne |
| 221 | { |
| 222 | stats="$1" |
| 223 | status=0 |
| 224 | |
| 225 | validate_min_max "$stats" "intfield" "0" "98" |
| 226 | status=$(($status|$?)) |
| 227 | |
| 228 | return $status |
| 229 | } |
| 230 | |
| 231 | function validator_intfield_not |
| 232 | { |
| 233 | stats="$1" |
| 234 | status=0 |
| 235 | |
| 236 | validate_min_max "$stats" "intfield" "0" "0" |
| 237 | status=$(($status|$?)) |
| 238 | |
| 239 | return $status |
| 240 | } |
| 241 | |
| 242 | function validator_intfield_gt_and_longfield_gt |
| 243 | { |
| 244 | stats="$1" |
| 245 | status=0 |
| 246 | |
| 247 | validate_min_max "$stats" "intfield" "43" "99" |
| 248 | status=$(($status|$?)) |
| 249 | validate_min_max "$stats" "longfield" "43" "99" |
| 250 | status=$(($status|$?)) |
| 251 | |
| 252 | return $status |
| 253 | } |
| 254 | |
| 255 | function validator_intfield_ge_and_longfield_le |
| 256 | { |
| 257 | stats="$1" |
| 258 | status=0 |
| 259 | |
| 260 | validate_min_max "$stats" "intfield" "42" "42" |
| 261 | status=$(($status|$?)) |
| 262 | validate_min_max "$stats" "longfield" "42" "42" |
| 263 | status=$(($status|$?)) |
| 264 | |
| 265 | return $status |
| 266 | } |
| 267 | |
| 268 | function validator_intfield_lt_or_longfield_gt |
| 269 | { |
| 270 | stats="$1" |
| 271 | status=0 |
| 272 | |
| 273 | validate_min_max "$stats" "intfield" "0" "99" |
| 274 | status=$(($status|$?)) |
| 275 | validate_min_max "$stats" "longfield" "0" "99" |
| 276 | status=$(($status|$?)) |
| 277 | |
| 278 | return $status |
| 279 | } |
| 280 | |
| 281 | function validator_mixed_str_or_int_and_int |
| 282 | { |
| 283 | stats="$1" |
| 284 | status=0 |
| 285 | |
| 286 | validate_min_max "$stats" "intfield" "34" "99" |
| 287 | status=$(($status|$?)) |
| 288 | |
| 289 | validate_min_max "$stats" "stringfield" "\"test\"" "\"test\"" |
| 290 | status=$(($status|$?)) |
| 291 | |
| 292 | return $status |
| 293 | } |
| 294 | |
| 295 | function validator_mixed_int_double |
| 296 | { |
| 297 | stats="$1" |
| 298 | status=0 |
| 299 | |
| 300 | validate_min_max "$stats" "intfield" "0" "42" |
| 301 | status=$(($status|$?)) |
| 302 | |
| 303 | return $status |
| 304 | } |
| 305 | |
| 306 | function validator_true_statement |
| 307 | { |
| 308 | stats="$1" |
| 309 | status=0 |
| 310 | |
| 311 | validate_min_max "$stats" "intfield" "0" "99" |
| 312 | status=$(($status|$?)) |
| 313 | |
| 314 | validate_min_max "$stats" "intfield2" "0x0" "0x63" |
| 315 | status=$(($status|$?)) |
| 316 | |
| 317 | validate_min_max "$stats" "longfield" "0" "99" |
| 318 | status=$(($status|$?)) |
| 319 | |
| 320 | validate_min_max "$stats" "netintfield" "0" "99" |
| 321 | status=$(($status|$?)) |
| 322 | |
| 323 | validate_min_max "$stats" "netintfieldhex" "0x0" "0x63" |
| 324 | status=$(($status|$?)) |
| 325 | |
| 326 | if [ $KERNEL_CHECK -eq 0 ]; then |
| 327 | validate_min_max "$stats" "floatfield" "2222" "2222" |
| 328 | status=$(($status|$?)) |
| 329 | |
| 330 | validate_min_max "$stats" "doublefield" "2" "2" |
| 331 | status=$(($status|$?)) |
| 332 | fi |
| 333 | |
| 334 | validate_min_max "$stats" "stringfield" "\"test\"" "\"test\"" |
| 335 | status=$(($status|$?)) |
| 336 | |
| 337 | validate_min_max "$stats" "stringfield2" ""\*"" ""\*"" |
| 338 | status=$(($status|$?)) |
| 339 | |
| 340 | return $status |
| 341 | } |
| 342 | |
| 343 | plan_tests $NUM_TESTS |
| 344 | |
| 345 | print_test_banner "$TEST_DESC" |
| 346 | |
| 347 | issue_356_filter="intfield > 0 && intfield > 1 && " |
| 348 | issue_356_filter+="intfield > 2 && intfield > 3 && " |
| 349 | issue_356_filter+="intfield > 4 && intfield > 5 && " |
| 350 | issue_356_filter+="intfield > 6 && intfield > 7 && " |
| 351 | issue_356_filter+="intfield > 8 || intfield > 0" |
| 352 | |
| 353 | start_lttng_sessiond |
| 354 | |
| 355 | ### UST TESTS |
| 356 | |
| 357 | BIN_NAME="gen-ust-events" |
| 358 | |
| 359 | # One to one mapping between filters and validators |
| 360 | |
| 361 | # Set IFS to newline to facilitate array declaration |
| 362 | OLDIFS="$IFS" |
| 363 | IFS=$'\n' |
| 364 | UST_FILTERS=("intfield" #1 |
| 365 | "intfield > 1" #2 |
| 366 | "intfield >= 1" #3 |
| 367 | "intfield < 2" #4 |
| 368 | "intfield <= 2" #5 |
| 369 | "intfield == 1" #6 |
| 370 | "intfield != 99" #7 |
| 371 | "!intfield" #8 |
| 372 | "-intfield" #9 |
| 373 | "--intfield" #10 |
| 374 | "+intfield" #11 |
| 375 | "++intfield" #12 |
| 376 | "intfield > 1 && longfield > 42" #13 |
| 377 | "intfield >= 42 && longfield <= 42" #14 |
| 378 | "intfield < 1 || longfield > 98" #15 |
| 379 | "(stringfield == \"test\" || intfield != 10) && intfield > 33" #16 |
| 380 | "intfield < 42.4242424242" #17 |
| 381 | "\"test\" == \"test\"" #18 #Issue #342 |
| 382 | "stringfield == \"test\"" #19 |
| 383 | "stringfield == \"t*\"" #20 |
| 384 | "stringfield == \"*\"" #21 |
| 385 | $issue_356_filter #22 #Issue #356 |
| 386 | "intfield < 0xDEADBEEF" #23 |
| 387 | "intfield < 0x2" #24 |
| 388 | "intfield < 02" #25 |
| 389 | "stringfield2 == \"\\\*\"" #26 |
| 390 | "1.0 || intfield || 1.0" #27 |
| 391 | "1 < intfield" #28 |
| 392 | "\$ctx.vtid == 0" #29 |
| 393 | "\$ctx.vtid != 0" #30 |
| 394 | "0 == \$ctx.vtid" #31 |
| 395 | "0 != \$ctx.vtid" #32 |
| 396 | "\$ctx.vpid == 0" #33 |
| 397 | "\$ctx.vpid != 0" #34 |
| 398 | "0 == \$ctx.vpid" #35 |
| 399 | "0 != \$ctx.vpid" #36 |
| 400 | "\$ctx.procname != \"$BIN_NAME\"" #37 |
| 401 | "\$ctx.procname == \"$BIN_NAME\"" #38 |
| 402 | "\"$BIN_NAME\" != \$ctx.procname" #39 |
| 403 | "\"$BIN_NAME\" == \$ctx.procname" #40 |
| 404 | "\$ctx.procname != \"$BIN_NAME*\"" #41 |
| 405 | "\$ctx.procname == \"$BIN_NAME*\"" #42 |
| 406 | "\"$BIN_NAME*\" != \$ctx.procname" #43 |
| 407 | "\"$BIN_NAME*\" == \$ctx.procname" #44 |
| 408 | "\$ctx.procname != \"*\"" #45 |
| 409 | "\$ctx.procname == \"*\"" #46 |
| 410 | "\"*\" != \$ctx.procname" #47 |
| 411 | "\"*\" == \$ctx.procname" #48 |
| 412 | ) |
| 413 | |
| 414 | UST_FILTER_COUNT=${#UST_FILTERS[@]} |
| 415 | |
| 416 | if [ ! -x "$CURDIR/$BIN_NAME" ]; then |
| 417 | BAIL_OUT "No UST nevents binary detected." |
| 418 | fi |
| 419 | |
| 420 | UST_VALIDATOR=("validator_intfield" #1 |
| 421 | "validator_intfield_gt" #2 |
| 422 | "validator_intfield_ge" #3 |
| 423 | "validator_intfield_lt" #4 |
| 424 | "validator_intfield_le" #5 |
| 425 | "validator_intfield_eq" #6 |
| 426 | "validator_intfield_ne" #7 |
| 427 | "validator_intfield_not" #8 |
| 428 | "validator_intfield" #9 |
| 429 | "validator_intfield" #10 |
| 430 | "validator_intfield" #11 |
| 431 | "validator_intfield" #12 |
| 432 | "validator_intfield_gt_and_longfield_gt" #13 |
| 433 | "validator_intfield_ge_and_longfield_le" #14 |
| 434 | "validator_intfield_lt_or_longfield_gt" #15 |
| 435 | "validator_mixed_str_or_int_and_int" #16 |
| 436 | "validator_mixed_int_double" #17 |
| 437 | "validator_true_statement" #18 |
| 438 | "validator_true_statement" #19 |
| 439 | "validator_true_statement" #20 |
| 440 | "validator_true_statement" #21 |
| 441 | "validator_intfield" #22 |
| 442 | "validator_true_statement" #23 |
| 443 | "validator_intfield_lt" #24 |
| 444 | "validator_intfield_lt" #25 |
| 445 | "validator_true_statement" #26 |
| 446 | "validator_true_statement" #27 |
| 447 | "validator_intfield_gt" #28 |
| 448 | "validator_has_no_event" #29 |
| 449 | "validator_has_events" #30 |
| 450 | "validator_has_no_event" #31 |
| 451 | "validator_has_events" #32 |
| 452 | "validator_has_no_event" #33 |
| 453 | "validator_has_events" #34 |
| 454 | "validator_has_no_event" #35 |
| 455 | "validator_has_events" #36 |
| 456 | "validator_has_no_event" #36 |
| 457 | "validator_has_events" #37 |
| 458 | "validator_has_no_event" #38 |
| 459 | "validator_has_events" #39 |
| 460 | "validator_has_no_event" #41 |
| 461 | "validator_has_events" #42 |
| 462 | "validator_has_no_event" #43 |
| 463 | "validator_has_events" #44 |
| 464 | "validator_has_no_event" #45 |
| 465 | "validator_has_events" #46 |
| 466 | "validator_has_no_event" #47 |
| 467 | "validator_has_events" #48 |
| 468 | ) |
| 469 | |
| 470 | IFS="$OLDIFS" |
| 471 | |
| 472 | diag "Test UST valid filters" |
| 473 | |
| 474 | KERNEL_CHECK=0 |
| 475 | i=0 |
| 476 | while [ "$i" -lt "$UST_FILTER_COUNT" ]; do |
| 477 | |
| 478 | test_valid_filter ust -u "tp:tptest" "${UST_FILTERS[$i]}" "${UST_VALIDATOR[$i]}" |
| 479 | |
| 480 | if [ $? -eq 1 ]; then |
| 481 | stop_lttng_sessiond |
| 482 | exit 1 |
| 483 | fi |
| 484 | |
| 485 | let "i++" |
| 486 | done |
| 487 | |
| 488 | |
| 489 | ### KERNEL TESTS |
| 490 | |
| 491 | BIN_NAME="test_valid_filt" # Current script name truncated by kernel |
| 492 | |
| 493 | # One to one mapping between filters and validators |
| 494 | # Set IFS to newline to facilitate array declaration |
| 495 | OLDIFS="$IFS" |
| 496 | IFS=$'\n' |
| 497 | KERNEL_FILTERS=("intfield" #1 |
| 498 | "intfield > 1" #2 |
| 499 | "intfield >= 1" #3 |
| 500 | "intfield < 2" #4 |
| 501 | "intfield <= 2" #5 |
| 502 | "intfield == 1" #6 |
| 503 | "intfield != 99" #7 |
| 504 | "!intfield" #8 |
| 505 | "-intfield" #9 |
| 506 | "--intfield" #10 |
| 507 | "+intfield" #11 |
| 508 | "++intfield" #12 |
| 509 | "intfield > 1 && longfield > 42" #13 |
| 510 | "intfield >= 42 && longfield <= 42" #14 |
| 511 | "intfield < 1 || longfield > 98" #15 |
| 512 | "(stringfield == \"test\" || intfield != 10) && intfield > 33" #16 |
| 513 | "intfield < 42.4242424242" #17 |
| 514 | "\"test\" == \"test\"" #18 #Issue #342 |
| 515 | "stringfield == \"test\"" #19 |
| 516 | "stringfield == \"t*\"" #20 |
| 517 | "stringfield == \"*\"" #21 |
| 518 | $issue_356_filter #22 #Issue #356 |
| 519 | "intfield < 0xDEADBEEF" #23 |
| 520 | "intfield < 0x2" #24 |
| 521 | "intfield < 02" #25 |
| 522 | "stringfield2 == \"\\\*\"" #26 |
| 523 | "1.0 || intfield || 1.0" #27 |
| 524 | "1 < intfield" #28 |
| 525 | "\$ctx.vtid == 0" #29 |
| 526 | "\$ctx.vtid != 0" #30 |
| 527 | "0 == \$ctx.vtid" #31 |
| 528 | "0 != \$ctx.vtid" #32 |
| 529 | "\$ctx.vpid == 0" #33 |
| 530 | "\$ctx.vpid != 0" #34 |
| 531 | "0 == \$ctx.vpid" #35 |
| 532 | "0 != \$ctx.vpid" #36 |
| 533 | "\$ctx.procname != \"$BIN_NAME\"" #37 |
| 534 | "\$ctx.procname == \"$BIN_NAME\"" #38 |
| 535 | "\"$BIN_NAME\" != \$ctx.procname" #39 |
| 536 | "\"$BIN_NAME\" == \$ctx.procname" #40 |
| 537 | "\$ctx.procname != \"$BIN_NAME*\"" #41 |
| 538 | "\$ctx.procname == \"$BIN_NAME*\"" #42 |
| 539 | "\"$BIN_NAME*\" != \$ctx.procname" #43 |
| 540 | "\"$BIN_NAME*\" == \$ctx.procname" #44 |
| 541 | "\$ctx.procname != \"*\"" #45 |
| 542 | "\$ctx.procname == \"*\"" #46 |
| 543 | "\"*\" != \$ctx.procname" #47 |
| 544 | "\"*\" == \$ctx.procname" #48 |
| 545 | ) |
| 546 | |
| 547 | KERNEL_FILTER_COUNT=${#KERNEL_FILTERS[@]} |
| 548 | |
| 549 | KERNEL_VALIDATOR=("validator_intfield" #1 |
| 550 | "validator_intfield_gt" #2 |
| 551 | "validator_intfield_ge" #3 |
| 552 | "validator_intfield_lt" #4 |
| 553 | "validator_intfield_le" #5 |
| 554 | "validator_intfield_eq" #6 |
| 555 | "validator_intfield_ne" #7 |
| 556 | "validator_intfield_not" #8 |
| 557 | "validator_intfield" #9 |
| 558 | "validator_intfield" #10 |
| 559 | "validator_intfield" #11 |
| 560 | "validator_intfield" #12 |
| 561 | "validator_intfield_gt_and_longfield_gt" #13 |
| 562 | "validator_intfield_ge_and_longfield_le" #14 |
| 563 | "validator_intfield_lt_or_longfield_gt" #15 |
| 564 | "validator_mixed_str_or_int_and_int" #16 |
| 565 | "validator_has_no_event" #17 #Unsupported by kernel |
| 566 | "validator_true_statement" #18 |
| 567 | "validator_true_statement" #19 |
| 568 | "validator_true_statement" #20 |
| 569 | "validator_true_statement" #21 |
| 570 | "validator_intfield" #22 |
| 571 | "validator_true_statement" #23 |
| 572 | "validator_intfield_lt" #24 |
| 573 | "validator_intfield_lt" #25 |
| 574 | "validator_true_statement" #26 |
| 575 | "validator_has_no_event" #27 #Unsupported by kernel |
| 576 | "validator_intfield_gt" #28 |
| 577 | "validator_has_no_event" #29 |
| 578 | "validator_has_events" #30 |
| 579 | "validator_has_no_event" #31 |
| 580 | "validator_has_events" #32 |
| 581 | "validator_has_no_event" #33 |
| 582 | "validator_has_events" #34 |
| 583 | "validator_has_no_event" #35 |
| 584 | "validator_has_events" #36 |
| 585 | "validator_has_no_event" #36 |
| 586 | "validator_has_events" #37 |
| 587 | "validator_has_no_event" #38 |
| 588 | "validator_has_events" #39 |
| 589 | "validator_has_no_event" #41 |
| 590 | "validator_has_events" #42 |
| 591 | "validator_has_no_event" #43 |
| 592 | "validator_has_events" #44 |
| 593 | "validator_has_no_event" #45 |
| 594 | "validator_has_events" #46 |
| 595 | "validator_has_no_event" #47 |
| 596 | "validator_has_events" #48 |
| 597 | ) |
| 598 | |
| 599 | IFS=$OLDIFS |
| 600 | |
| 601 | if [ "$(id -u)" == "0" ]; then |
| 602 | isroot=1 |
| 603 | else |
| 604 | isroot=0 |
| 605 | fi |
| 606 | |
| 607 | skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $NUM_KERNEL_TESTS || |
| 608 | { |
| 609 | diag "Test kernel valid filters" |
| 610 | |
| 611 | KERNEL_CHECK=1 |
| 612 | modprobe lttng-test |
| 613 | i=0 |
| 614 | while [ "$i" -lt "$KERNEL_FILTER_COUNT" ]; do |
| 615 | |
| 616 | test_valid_filter kernel -k "lttng_test_filter_event" \ |
| 617 | "${KERNEL_FILTERS[$i]}" "${KERNEL_VALIDATOR[$i]}" |
| 618 | |
| 619 | if [ $? -eq 1 ]; then |
| 620 | stop_lttng_sessiond |
| 621 | exit 1 |
| 622 | fi |
| 623 | |
| 624 | let "i++" |
| 625 | done |
| 626 | rmmod lttng-test |
| 627 | } |
| 628 | |
| 629 | stop_lttng_sessiond |