Limit the scope of IFS overwriting
[lttng-tools.git] / tests / regression / tools / filtering / test_invalid_filter
index bfc817d3f1133655a53af10f33413cbfba6d19d8..ebf4c3bb1df7c1e1c96cc9bc2a0afe5b89f394de 100755 (executable)
@@ -25,8 +25,8 @@ EVENT_NAME="bogus"
 ENABLE_EVENT_STDERR="/tmp/invalid-filters-stderr"
 TRACE_PATH=$(mktemp -d)
 NUM_GLOBAL_TESTS=2
-NUM_UST_TESTS=144
-NUM_KERNEL_TESTS=144
+NUM_UST_TESTS=123
+NUM_KERNEL_TESTS=123
 NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
 
 source $TESTDIR/utils/utils.sh
@@ -93,6 +93,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+OLDIFS="$IFS"
 IFS=$'\n'
 INVALID_FILTERS=(
                # Unsupported ops
@@ -117,14 +118,10 @@ 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\""
@@ -141,11 +138,6 @@ INVALID_FILTERS=(
                # 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
@@ -153,13 +145,17 @@ INVALID_FILTERS=(
                "0 == \$global.value"
                # A wildcard should only appear as the last character in a string literal
                "msg == \"my_event*_blah\""
-               )
+)
+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 +169,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
This page took 0.026953 seconds and 5 git commands to generate.