From c4fd489fe80828d8eaa1cca7f25ae87ebb6d77f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 28 Aug 2014 12:53:44 -0400 Subject: [PATCH] Tests: Validate that filters may be used with JUL's logger_name filtering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This test validates that custom filters may be used on JUL events without interfering with the implicit filtering done on the logger_name field. Signed-off-by: Jérémie Galarneau Signed-off-by: David Goulet --- tests/regression/ust/java-jul/test_java_jul | 42 ++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/regression/ust/java-jul/test_java_jul b/tests/regression/ust/java-jul/test_java_jul index dc6e677f3..6c888eb8f 100755 --- a/tests/regression/ust/java-jul/test_java_jul +++ b/tests/regression/ust/java-jul/test_java_jul @@ -29,7 +29,7 @@ EVENT_NAME="JTestLTTng" EVENT_NAME2="JTestLTTng2" JAVA_CP="$CURDIR:/usr/local/lib/lttng/java/liblttng-ust-jul.jar:/usr/lib/lttng/java/liblttng-ust-jul.jar" -NUM_TESTS=124 +NUM_TESTS=131 source $TESTDIR/utils/utils.sh @@ -74,6 +74,17 @@ function enable_jul_filter() ok $? "Enable event $event_name with filter $filter for session $sess_name" } +function enable_jul_filter_loglevel_only() +{ + local sess_name="$1" + local event_name="$2" + local filter="$3" + local loglevel="$4" + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event --loglevel-only $loglevel "$event_name" -s $sess_name -j --filter "$filter" >/dev/null 2>&1 + ok $? "Enable event $event_name with filter \"$filter\" and loglevel-only $loglevel for session $sess_name" +} + # MUST set TESTDIR before calling those functions function test_jul_before_start () @@ -443,6 +454,34 @@ function test_jul_disable_enable() fi } +function test_jul_filter_loglevel() +{ + local BOGUS_EVENT_NAME="not_a_real_event" + local FILTER="int_loglevel > 700 || int_loglevel < 700" + local ALL_EVENTS="." + + diag "Test JUL a filter with a loglevel" + + create_lttng_session $SESSION_NAME $TRACE_PATH/$SESSION_NAME + # Enable an event with a filter and the loglevel-only option. + enable_jul_filter_loglevel_only $SESSION_NAME $BOGUS_EVENT_NAME "$FILTER" JUL_CONFIG + disable_jul_lttng_event $SESSION_NAME $BOGUS_EVENT_NAME + enable_jul_filter_loglevel_only $SESSION_NAME $BOGUS_EVENT_NAME "$FILTER" JUL_CONFIG + start_lttng_tracing $SESSION_NAME + + # Run 5 times with a 1 second delay and fire second TP. + run_app 0 1 + + stop_lttng_tracing $SESSION_NAME + destroy_lttng_session $SESSION_NAME + + # Validate test. Expecting no events. + trace_match_only $ALL_EVENTS 0 $TRACE_PATH/$SESSION_NAME + if [ $? -ne 0 ]; then + return $? + fi +} + plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" @@ -469,6 +508,7 @@ skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS || test_jul_before_start test_jul_after_start test_jul_multi_session + test_jul_filter_loglevel ) for fct_test in ${tests[@]}; -- 2.34.1