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)
28 source $TESTDIR/utils
/utils.sh
30 function enable_ust_lttng_event_filter_unsupported
36 enable_cmd
="$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event"
37 $enable_cmd $event_name -s $sess_name -u --filter "$filter" 2> $ENABLE_EVENT_STDERR 1> /dev
/null
41 fail
"Enable lttng event with filtering and unsupported operator"
44 pass
"Enable lttng event with filtering and unsupported operator"
49 function test_unsupported_op
54 diag
"Test filter expression with unsupported operator $test_op_str ($test_op_tkn)"
57 create_lttng_session
$SESSION_NAME $TRACE_PATH
60 if [ "$test_op_str" == "UNARY_BIN_NOT" ]; then
61 TEST_FILTER
="${test_op_tkn}1"
63 TEST_FILTER
="intfield $test_op_tkn 1"
67 enable_ust_lttng_event_filter_unsupported
$SESSION_NAME $EVENT_NAME "$TEST_FILTER"
69 # Test stderr for unsupported operator
71 grep -i -q "not[[:space:]]\+supported" $ENABLE_EVENT_STDERR
74 fail
"Unsupported operator test $test_op_str ($test_op_tkn)"
77 pass
"Unsupported operator test $test_op_str ($test_op_tkn)"
81 destroy_lttng_session
$SESSION_NAME
87 print_test_banner
"$TEST_DESC"
89 # Unsupported operators
90 OP_STR
=("MUL" "DIV" "MOD" "PLUS" "MINUS" "LSHIFT" "RSHIFT"
91 "BIN_AND" "BIN_OR" "BIN_XOR" "UNARY_BIN_NOT")
93 OP_TKN
=("*" "/" "%" "+" "-" "<<" ">>" "&" "|" "^" "~")
95 OP_COUNT
=${#OP_STR[@]}
100 while [ "$i" -lt "$OP_COUNT" ]; do
101 test_unsupported_op
"${OP_STR[$i]}" "${OP_TKN[$i]}"
103 if [ $?
-eq 1 ]; then
113 rm -f $ENABLE_EVENT_STDERR