Add exclusion regression test
authorDavid Goulet <dgoulet@efficios.com>
Thu, 14 Nov 2013 20:37:01 +0000 (15:37 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 14 Nov 2013 20:37:01 +0000 (15:37 -0500)
Signed-off-by: David Goulet <dgoulet@efficios.com>
configure.ac
tests/fast_regression
tests/regression/tools/Makefile.am
tests/regression/tools/exclusion/Makefile.am [new file with mode: 0644]
tests/regression/tools/exclusion/test_exclusion [new file with mode: 0755]

index 09e434baec1fb029fff6849b63189afd91797a29..1736904254628a1d9439dd0b8a857bfff333b82b 100644 (file)
@@ -374,6 +374,7 @@ AC_CONFIG_FILES([
        tests/regression/tools/tracefile-limits/Makefile
        tests/regression/tools/snapshots/Makefile
        tests/regression/tools/live/Makefile
+       tests/regression/tools/exclusion/Makefile
        tests/regression/ust/Makefile
        tests/regression/ust/nprocesses/Makefile
        tests/regression/ust/high-throughput/Makefile
index 6c9fa3986b58e36f0979a4199acecb5dac5130bc..64b089225fe1971abbd269719b119dbe865947c9 100644 (file)
@@ -7,6 +7,7 @@ regression/tools/live/test_ust_tracefile_count
 regression/tools/live/test_lttng_ust
 regression/tools/tracefile-limits/test_tracefile_count
 regression/tools/tracefile-limits/test_tracefile_size
+regression/tools/exclusion/test_exclusion
 regression/tools/snapshots/test_ust
 regression/tools/snapshots/test_ust_streaming
 regression/ust/before-after/test_before_after
index fa1df870065a2145b4f6d10722c03b501f67d2b5..f3bdc25f4ee9eb0fab668648d04c49533413b407 100644 (file)
@@ -1 +1 @@
-SUBDIRS = streaming filtering health tracefile-limits snapshots live
+SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion
diff --git a/tests/regression/tools/exclusion/Makefile.am b/tests/regression/tools/exclusion/Makefile.am
new file mode 100644 (file)
index 0000000..caa04a0
--- /dev/null
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_exclusion
+EXTRA_DIST = test_exclusion
+
+all-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       cp -f $(srcdir)/$$script $(builddir); \
+               done; \
+       fi
+
+clean-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       rm -f $(builddir)/$$script; \
+               done; \
+       fi
diff --git a/tests/regression/tools/exclusion/test_exclusion b/tests/regression/tools/exclusion/test_exclusion
new file mode 100755 (executable)
index 0000000..d093e1e
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com>
+#
+# 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
This page took 0.028511 seconds and 4 git commands to generate.