3 # Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com>
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.
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
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.
18 TEST_DESC
="Filtering - Unsupported operators"
21 TESTDIR
=$CURDIR/..
/..
/..
23 SESSION_NAME
="filter-unsupported-ops"
25 ENABLE_EVENT_STDERR
="/tmp/unsupported-ops-enable"
26 TRACE_PATH
=$
(mktemp
-d)
30 NUM_TESTS
=$
(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
32 source $TESTDIR/utils
/utils.sh
34 function enable_lttng_event_filter_unsupported
41 enable_cmd
="$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event"
42 $enable_cmd $event_name -s $sess_name $domain --filter "$filter" 2> $ENABLE_EVENT_STDERR 1> /dev
/null
46 fail
"Enable lttng event with filtering and unsupported operator"
49 pass
"Enable lttng event with filtering and unsupported operator"
54 function test_unsupported_op
60 diag
"Test filter expression with unsupported operator $test_op_str ($test_op_tkn)"
63 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
66 if [ "$test_op_str" == "UNARY_BIN_NOT" ]; then
67 TEST_FILTER
="${test_op_tkn}1"
69 TEST_FILTER
="intfield $test_op_tkn 1"
73 enable_lttng_event_filter_unsupported
$domain $SESSION_NAME $EVENT_NAME "$TEST_FILTER"
75 # Test stderr for unsupported operator
77 grep -i -q "not[[:space:]]\+supported" $ENABLE_EVENT_STDERR
80 fail
"Unsupported operator test $test_op_str ($test_op_tkn)"
83 pass
"Unsupported operator test $test_op_str ($test_op_tkn)"
87 destroy_lttng_session_ok
$SESSION_NAME
93 print_test_banner
"$TEST_DESC"
95 # Unsupported operators
96 OP_STR
=("MUL" "DIV" "MOD" "PLUS" "MINUS" "LSHIFT" "RSHIFT"
97 "BIN_AND" "BIN_OR" "BIN_XOR" "UNARY_BIN_NOT")
99 OP_TKN
=("*" "/" "%" "+" "-" "<<" ">>" "&" "|" "^" "~")
101 OP_COUNT
=${#OP_STR[@]}
105 diag
"Test UST unsupported filter operations"
108 while [ "$i" -lt "$OP_COUNT" ]; do
109 test_unsupported_op
-u "${OP_STR[$i]}" "${OP_TKN[$i]}"
111 if [ $?
-eq 1 ]; then
118 if [ "$(id -u)" == "0" ]; then
124 skip
$isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS ||
126 diag
"Test kernel unsupported filter operations"
129 while [ "$i" -lt "$OP_COUNT" ]; do
130 test_unsupported_op
-k "${OP_STR[$i]}" "${OP_TKN[$i]}"
132 if [ $?
-eq 1 ]; then
143 rm -f $ENABLE_EVENT_STDERR