X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ffiltering%2Ftest_valid_filter;h=cfd8de3bfbe189b994f02e2bbdf0a76a866833f6;hp=a916b188441b8f97eaae026d085fc532227488d1;hb=39ac0a0ee6d55413d4f4a800db811f5dae0ae4ae;hpb=bff988fac4f8d1ffab3f85f0eec9546c76e57706 diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index a916b1884..cfd8de3bf 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -1,31 +1,20 @@ #!/bin/bash # -# Copyright (C) - 2012 Christian Babeux +# Copyright (C) 2012 Christian Babeux # -# 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 -# published by the Free Software Foundation. +# SPDX-License-Identifier: GPL-2.0-only # -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. TEST_DESC="Filtering - Valid filters" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../.. -LTTNG_BIN="lttng" STATS_BIN="$TESTDIR/utils/babelstats.pl" SESSION_NAME="valid_filter" NR_ITER=100 NUM_GLOBAL_TESTS=2 -NUM_UST_TESTS=1002 -NUM_KERNEL_TESTS=936 +NUM_UST_TESTS=1122 +NUM_KERNEL_TESTS=1056 NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS)) source $TESTDIR/utils/utils.sh @@ -674,28 +663,82 @@ UST_FILTERS=( "1 >= (1 >= (1 >= 1))" true_statement - "0x101 & 0x100 == 0x100" + "(0x101 & 0x100) == 0x100" + + true_statement + "(0x101 | 0x10100) == 0x10101" + + true_statement + "(0xF00F0F ^ 0xFF0F00) == 0x0F000F" + + true_statement + "(1 << 1) == 2" + + true_statement + "(4 >> 1) == 2" + + true_statement + "(1 << 8) == 256" + + true_statement + "(262144 >> 16) == 4" true_statement - "0x101 | 0x10100 == 0x10101" + "(~0 & 0xffff) == 0xffff" true_statement - "0xF00F0F ^ 0xFF0F00 == 0x0F000F" + "(~0 & 0xffffffff) == 0xffffffff" true_statement - "arrfield1[2] & 1 == 1" + "(~0 & 0xffffffffffffffff) == 0xffffffffffffffff" true_statement - "arrfield1[2] | 0x111000 == 0x111003" + "-1==~0" + + true_statement # unsigned bitwise ops + "~0>>4==0x0fffffffffffffff" + + has_no_event + "1<<-1" + + has_no_event + "1<<10000" + + true_statement # comparator is signed, shift is unsigned + "(1<<63) < 0" + + true_statement + "(1<<2!=4)==0" # operator priority: shift before equality + + true_statement + "1&3==1" # operator priority: masks before equality + + true_statement + "(3|1==3)==1" # operator priority: masks before equality + + true_statement + "(2^1==3)==1" # operator priority: masks before equality + + true_statement + "(1 << 32) == 4294967296" + + true_statement + "(1 << 63) == 9223372036854775808" + + true_statement + "(arrfield1[2] & 1) == 1" + + true_statement + "(arrfield1[2] | 0x111000) == 0x111003" true_statement "(arrfield1[0] | arrfield1[1] | arrfield1[2]) == 0x3" true_statement - "seqfield4[2] & 1 == 1" + "(seqfield4[2] & 1) == 1" true_statement - "seqfield4[2] | 0x111000 == 0x111003" + "(seqfield4[2] | 0x111000) == 0x111003" true_statement "intfield < 0xDEADBEEF" @@ -790,6 +833,16 @@ UST_FILTERS=( has_no_event "0 == \$ctx.vtid.blah" + # check that bytecode linker refuses to link against a + # non-string array. + has_no_event + 'arrfield1 != "dontmatch"' + + # check that bytecode linker refuses to link against a + # non-string sequence. + has_no_event + 'seqfield1 != "dontmatch"' + END ) @@ -1099,28 +1152,82 @@ KERNEL_FILTERS=( "1 >= (1 >= (1 >= 1))" true_statement - "0x101 & 0x100 == 0x100" + "(0x101 & 0x100) == 0x100" true_statement - "0x101 | 0x10100 == 0x10101" + "(0x101 | 0x10100) == 0x10101" true_statement - "0xF00F0F ^ 0xFF0F00 == 0x0F000F" + "(0xF00F0F ^ 0xFF0F00) == 0x0F000F" true_statement - "arrfield1[2] & 1 == 1" + "(1 << 1) == 2" true_statement - "arrfield1[2] | 0x111000 == 0x111003" + "(4 >> 1) == 2" + + true_statement + "(1 << 8) == 256" + + true_statement + "(262144 >> 16) == 4" + + true_statement + "(~0 & 0xffff) == 0xffff" + + true_statement + "(~0 & 0xffffffff) == 0xffffffff" + + true_statement + "(~0 & 0xffffffffffffffff) == 0xffffffffffffffff" + + true_statement + "-1==~0" + + true_statement # unsigned bitwise ops + "~0>>4==0x0fffffffffffffff" + + has_no_event + "1<<-1" + + has_no_event + "1<<10000" + + true_statement # comparator is signed, shift is unsigned + "(1<<63) < 0" + + true_statement + "(1<<2!=4)==0" # operator priority: shift before equality + + true_statement + "1&3==1" # operator priority: masks before equality + + true_statement + "(3|1==3)==1" # operator priority: masks before equality + + true_statement + "(2^1==3)==1" # operator priority: masks before equality + + true_statement + "(1 << 32) == 4294967296" + + true_statement + "(1 << 63) == 9223372036854775808" + + true_statement + "(arrfield1[2] & 1) == 1" + + true_statement + "(arrfield1[2] | 0x111000) == 0x111003" true_statement "(arrfield1[0] | arrfield1[1] | arrfield1[2]) == 0x3" true_statement - "seqfield4[2] & 1 == 1" + "(seqfield4[2] & 1) == 1" true_statement - "seqfield4[2] | 0x111000 == 0x111003" + "(seqfield4[2] | 0x111000) == 0x111003" true_statement "intfield < 0xDEADBEEF" @@ -1329,6 +1436,16 @@ KERNEL_FILTERS=( has_no_event 'stringfield == "test\*"' + # check that bytecode linker refuses to link against a + # non-string array. + has_no_event + 'arrfield1 != "dontmatch"' + + # check that bytecode linker refuses to link against a + # non-string sequence. + has_no_event + 'seqfield1 != "dontmatch"' + ${KIRK_KRAUSS_TESTS[@]} END @@ -1368,7 +1485,7 @@ skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $N i=$(( i + 2 )) done - rmmod lttng-test + modprobe --remove lttng-test } stop_lttng_sessiond