X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Ffiltering%2Ftest_unsupported_op;h=3cba1718669cf435b97a689b611b0a3b5aa150a5;hp=d0c6c862027a1a69ac47b2fb04d7dbea43d7d2b0;hb=9d16b343fb9e781fc8d8fa3c448a3f382306dd33;hpb=5d2e1e66a968d9e555f9b8b00d0589ebfaf3de32 diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op index d0c6c8620..3cba17186 100755 --- a/tests/regression/tools/filtering/test_unsupported_op +++ b/tests/regression/tools/filtering/test_unsupported_op @@ -1,42 +1,34 @@ #!/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 - Unsupported operators" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../.. -LTTNG_BIN="lttng" SESSION_NAME="filter-unsupported-ops" EVENT_NAME="bogus" ENABLE_EVENT_STDERR="/tmp/unsupported-ops-enable" TRACE_PATH=$(mktemp -d) -NUM_TESTS=46 -source $TESTDIR/utils/utils.sh +NUM_GLOBAL_TESTS=2 +NUM_UST_TESTS=20 +NUM_KERNEL_TESTS=20 +NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS)) -print_test_banner "$TEST_DESC" +source $TESTDIR/utils/utils.sh -function enable_ust_lttng_event_filter_unsupported +function enable_lttng_event_filter_unsupported { - sess_name=$1 - event_name=$2 - filter=$3 + domain="$1" + sess_name="$2" + event_name="$3" + filter="$4" enable_cmd="$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event" - $enable_cmd $event_name -s $sess_name -u --filter "$filter" 2> $ENABLE_EVENT_STDERR 1> /dev/null + $enable_cmd $event_name -s $sess_name $domain --filter "$filter" 2> $ENABLE_EVENT_STDERR 1> /dev/null # Enable must fail if [ $? -eq 0 ]; then @@ -50,13 +42,14 @@ function enable_ust_lttng_event_filter_unsupported function test_unsupported_op { - test_op_str=$1 - test_op_tkn=$2 + domain="$1" + test_op_str="$2" + test_op_tkn="$3" diag "Test filter expression with unsupported operator $test_op_str ($test_op_tkn)" # Create session - create_lttng_session $SESSION_NAME $TRACE_PATH + create_lttng_session_ok $SESSION_NAME $TRACE_PATH # Create filter if [ "$test_op_str" == "UNARY_BIN_NOT" ]; then @@ -66,7 +59,7 @@ function test_unsupported_op fi # Apply filter - enable_ust_lttng_event_filter_unsupported $SESSION_NAME $EVENT_NAME "$TEST_FILTER" + enable_lttng_event_filter_unsupported $domain $SESSION_NAME $EVENT_NAME "$TEST_FILTER" # Test stderr for unsupported operator @@ -80,25 +73,28 @@ function test_unsupported_op fi # Destroy session - destroy_lttng_session $SESSION_NAME + destroy_lttng_session_ok $SESSION_NAME return 0 } plan_tests $NUM_TESTS +print_test_banner "$TEST_DESC" + # Unsupported operators -OP_STR=("MUL" "DIV" "MOD" "PLUS" "MINUS" "LSHIFT" "RSHIFT" - "BIN_AND" "BIN_OR" "BIN_XOR" "UNARY_BIN_NOT") +OP_STR=("MUL" "DIV" "MOD" "PLUS" "MINUS") -OP_TKN=("*" "/" "%" "+" "-" "<<" ">>" "&" "|" "^" "~") +OP_TKN=("*" "/" "%" "+" "-") OP_COUNT=${#OP_STR[@]} -i=0 start_lttng_sessiond +diag "Test UST unsupported filter operations" + +i=0 while [ "$i" -lt "$OP_COUNT" ]; do - test_unsupported_op "${OP_STR[$i]}" "${OP_TKN[$i]}" + test_unsupported_op -u "${OP_STR[$i]}" "${OP_TKN[$i]}" if [ $? -eq 1 ]; then exit 1 @@ -107,6 +103,28 @@ while [ "$i" -lt "$OP_COUNT" ]; do let "i++" done +if [ "$(id -u)" == "0" ]; then + isroot=1 +else + isroot=0 +fi + +skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS || +{ + diag "Test kernel unsupported filter operations" + + i=0 + while [ "$i" -lt "$OP_COUNT" ]; do + test_unsupported_op -k "${OP_STR[$i]}" "${OP_TKN[$i]}" + + if [ $? -eq 1 ]; then + exit 1 + fi + + let "i++" + done +} + stop_lttng_sessiond # Cleanup