tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / tools / filtering / test_invalid_filter
index 9df5f2cbfc439bfd542633e6b11126537e146dcc..f336f71925b378d01e301d4a89880e88a9c527f2 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 #
-# Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com>
+# Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License, version 2 only, as
@@ -19,14 +21,13 @@ TEST_DESC="Filtering - Invalid filters"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
-LTTNG_BIN="lttng"
 SESSION_NAME="filter-invalid"
 EVENT_NAME="bogus"
 ENABLE_EVENT_STDERR="/tmp/invalid-filters-stderr"
 TRACE_PATH=$(mktemp -d)
 NUM_GLOBAL_TESTS=2
-NUM_UST_TESTS=123
-NUM_KERNEL_TESTS=123
+NUM_UST_TESTS=135
+NUM_KERNEL_TESTS=135
 NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
 
 source $TESTDIR/utils/utils.sh
@@ -93,6 +94,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+OLDIFS="$IFS"
 IFS=$'\n'
 INVALID_FILTERS=(
                # Unsupported ops
@@ -100,12 +102,6 @@ INVALID_FILTERS=(
                "intfield/1"
                "intfield+1"
                "intfield-1"
-               "intfield>>1"
-               "intfield<<1"
-               "intfield&1"
-               "intfield|1"
-               "intfield^1"
-               "~intfield"
                "1+11111-3333+1"
                "(1+2)*(55*666)"
                "1+2*55*666"
@@ -119,9 +115,7 @@ INVALID_FILTERS=(
                '0 || ("abc" != "def")) && (3 < 4)'
                "a->"
                "a-->a"
-               "a->a"
                "a.b.c->d.e.f+1"
-               "asdfasdf->asdfasdf < 2"
                # String can\'t be root node
                "\"somestring\""
                # Unary op on string not allowed
@@ -134,23 +128,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))"
                "\$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
@@ -164,15 +175,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.025639 seconds and 5 git commands to generate.