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/..
/..
/..
22 SESSION_NAME
="filter-unsupported-ops"
24 ENABLE_EVENT_STDERR
="/tmp/unsupported-ops-enable"
25 TRACE_PATH
=$
(mktemp
-d)
29 NUM_TESTS
=$
(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
31 source $TESTDIR/utils
/utils.sh
33 function enable_lttng_event_filter_unsupported
40 enable_cmd
="$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event"
41 $enable_cmd $event_name -s $sess_name $domain --filter "$filter" 2> $ENABLE_EVENT_STDERR 1> /dev
/null
45 fail
"Enable lttng event with filtering and unsupported operator"
48 pass
"Enable lttng event with filtering and unsupported operator"
53 function test_unsupported_op
59 diag
"Test filter expression with unsupported operator $test_op_str ($test_op_tkn)"
62 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
65 if [ "$test_op_str" == "UNARY_BIN_NOT" ]; then
66 TEST_FILTER
="${test_op_tkn}1"
68 TEST_FILTER
="intfield $test_op_tkn 1"
72 enable_lttng_event_filter_unsupported
$domain $SESSION_NAME $EVENT_NAME "$TEST_FILTER"
74 # Test stderr for unsupported operator
76 grep -i -q "not[[:space:]]\+supported" $ENABLE_EVENT_STDERR
79 fail
"Unsupported operator test $test_op_str ($test_op_tkn)"
82 pass
"Unsupported operator test $test_op_str ($test_op_tkn)"
86 destroy_lttng_session_ok
$SESSION_NAME
92 print_test_banner
"$TEST_DESC"
94 # Unsupported operators
95 OP_STR
=("MUL" "DIV" "MOD" "PLUS" "MINUS")
97 OP_TKN
=("*" "/" "%" "+" "-")
99 OP_COUNT
=${#OP_STR[@]}
103 diag
"Test UST unsupported filter operations"
106 while [ "$i" -lt "$OP_COUNT" ]; do
107 test_unsupported_op
-u "${OP_STR[$i]}" "${OP_TKN[$i]}"
109 if [ $?
-eq 1 ]; then
116 if [ "$(id -u)" == "0" ]; then
122 skip
$isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS ||
124 diag
"Test kernel unsupported filter operations"
127 while [ "$i" -lt "$OP_COUNT" ]; do
128 test_unsupported_op
-k "${OP_STR[$i]}" "${OP_TKN[$i]}"
130 if [ $?
-eq 1 ]; then
141 rm -f $ENABLE_EVENT_STDERR