X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ffiltering%2Ftest_invalid_filter;h=2c45ee09e75170b0738bec630cb8d6a8d409f893;hp=bfc817d3f1133655a53af10f33413cbfba6d19d8;hb=bff988fac4f8d1ffab3f85f0eec9546c76e57706;hpb=f6788fc449c6001c57476ee37c3387d299e08109 diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter index bfc817d3f..2c45ee09e 100755 --- a/tests/regression/tools/filtering/test_invalid_filter +++ b/tests/regression/tools/filtering/test_invalid_filter @@ -93,6 +93,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" +OLDIFS="$IFS" IFS=$'\n' INVALID_FILTERS=( # Unsupported ops @@ -102,9 +103,6 @@ INVALID_FILTERS=( "intfield-1" "intfield>>1" "intfield<<1" - "intfield&1" - "intfield|1" - "intfield^1" "~intfield" "1+11111-3333+1" "(1+2)*(55*666)" @@ -117,15 +115,9 @@ INVALID_FILTERS=( # Unmatched parenthesis "((((((((((((((intfield)))))))))))))" '0 || ("abc" != "def")) && (3 < 4)' - # Field dereference - "a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a" "a->" "a-->a" - "a->a" "a.b.c->d.e.f+1" - "!a.f.d" - "asdf.asdfsd.sadf < 4" - "asdfasdf->asdfasdf < 2" # String can\'t be root node "\"somestring\"" # Unary op on string not allowed @@ -138,28 +130,40 @@ INVALID_FILTERS=( # Logical operator with string type not allowed "\"somestring\" || 1" "1 || \"somestring\"" - # Nesting of binary operator not allowed - "1 | (1 | (1 | 1))" - "1 > (1 > (1 > 1))" - # Exactly one chaining level under \$ctx allowed - "\$ctx.vtid.blah == 0" - "0 == \$ctx.vtid.blah" - "\$ctx.44 == 0" - "0 == \$ctx.44" "\$ctx == 0" "0 == \$ctx" # Only \$ctx is supported for now "\$global.value == 0" "0 == \$global.value" - # A wildcard should only appear as the last character in a string literal - "msg == \"my_event*_blah\"" - ) + # Cannot compare two full star globbing patterns + '"hello*world" == "yes*man"' + '"hello*world" == "yesman*"' + '"helloworld*" == "yes*man"' + # May only use != and == operators when one of them is a full + # star globbing pattern + '"hello*world" < field' + '"hello*world" <= field' + '"hello*world" >= field' + '"hello*world" > field' + '"hello*world" || field' + '"hello*world" && field' + 'field < "hello*world"' + 'field <= "hello*world"' + 'field >= "hello*world"' + 'field > "hello*world"' + 'field && "hello*world"' + 'field || "hello*world"' +) +IFS="$OLDIFS" start_lttng_sessiond diag "Test UST filters" -for FILTER in ${INVALID_FILTERS[@]}; -do - test_invalid_filter -u "$FILTER" + +i=0 +while [ "$i" -lt "${#INVALID_FILTERS[@]}" ]; do + echo "${INVALID_FILTERS[$i]}" + test_invalid_filter -u "${INVALID_FILTERS[$i]}" + let "i++" done test_bytecode_limit -u @@ -173,15 +177,15 @@ fi skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS || { diag "Test kernel filters" - for FILTER in ${INVALID_FILTERS[@]}; - do - test_invalid_filter -k "$FILTER" + i=0 + while [ "$i" -lt "${#INVALID_FILTERS[@]}" ]; do + echo "${INVALID_FILTERS[$i]}" + test_invalid_filter -k "${INVALID_FILTERS[$i]}" + let "i++" done test_bytecode_limit -k } - -unset IFS stop_lttng_sessiond rm -f $ENABLE_EVENT_STDERR