X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fexclusion%2Ftest_exclusion;fp=tests%2Fregression%2Ftools%2Fexclusion%2Ftest_exclusion;h=d093e1e1fe24b41d2b653b0e89c3854a148220a8;hp=0000000000000000000000000000000000000000;hb=345121ec1049b7634d27b1ea304c1d57e765261f;hpb=67676bd8b522e83c6d45c7f6a205ab7a30001c9d diff --git a/tests/regression/tools/exclusion/test_exclusion b/tests/regression/tools/exclusion/test_exclusion new file mode 100755 index 000000000..d093e1e1f --- /dev/null +++ b/tests/regression/tools/exclusion/test_exclusion @@ -0,0 +1,93 @@ +#!/bin/bash +# +# 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. +# +# 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="Event exclusion" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../../.. +LTTNG_BIN="lttng" +STATS_BIN="$TESTDIR/utils/babelstats.pl" +SESSION_NAME="test-exclusion" +EV_EXCLUDE_NAME="tp:tptest2" +TESTAPP_PATH="$TESTDIR/utils/testapp" +TESTAPP_NAME="gen-ust-nevents" +TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" +NR_ITER=100 +NR_USEC_WAIT=1 +NUM_TESTS=9 + +source $TESTDIR/utils/utils.sh + +function enable_ust_lttng_all_event_exclusion() +{ + sess_name="$1" + exclusion="$2" + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event -a -s $sess_name -u -x "$exclusion" 2>&1 >/dev/null + + ok $? "Enable lttng event with event $EV_EXCLUDE_NAME excluded" +} + +function run_apps +{ + $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 & +} + +function wait_apps +{ + while [ -n "$(pidof $BIN_NAME)" ]; do + sleep 1 + done + pass "Wait for application end" +} + +function test_exclusion +{ + trace_path=$(mktemp -d) + + # Create session + create_lttng_session $SESSION_NAME $trace_path + + enable_ust_lttng_all_event_exclusion $SESSION_NAME $EV_EXCLUDE_NAME + + # Trace apps + start_lttng_tracing $SESSION_NAME + run_apps + wait_apps + stop_lttng_tracing $SESSION_NAME + + # Destroy session + destroy_lttng_session $SESSION_NAME + + stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $EV_EXCLUDE_NAME | grep -v index` + if [ ! -z "$stats" ]; then + fail "Excluded event $EV_EXCLUDE_NAME was found in trace!" + else + ok 0 "Validate trace exclusion output" + rm -rf $trace_path + fi +} + +plan_tests $NUM_TESTS + +print_test_banner $TEST_DESC + +start_lttng_sessiond + +test_exclusion + +stop_lttng_sessiond