Tests: add JUL test for multiple loglevel
authorDavid Goulet <dgoulet@efficios.com>
Thu, 27 Feb 2014 19:48:07 +0000 (14:48 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 27 Feb 2014 19:48:11 +0000 (14:48 -0500)
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/regression/ust/java-jul/JTestLTTng.java
tests/regression/ust/java-jul/test_java_jul

index 5f15e143890a521452476b1d4ad3dfe61d334578..b39f7e3455ff555ba12a661488c3770760e8d8f3 100644 (file)
@@ -17,6 +17,7 @@
 
 import java.lang.Integer;
 import java.util.logging.Logger;
+import java.util.logging.Level;
 
 import org.lttng.ust.jul.LTTngAgent;
 
@@ -31,9 +32,14 @@ public class JTestLTTng
                int waitTime = Integer.parseInt(args[1]);
 
                lttngAgent = LTTngAgent.getLTTngAgent();
+               lttng.setLevel(Level.FINEST);
 
                for (int iter = 0; iter < nrIter; iter++) {
                        lttng.info("JUL tp fired!");
+                       if (args.length == 3) {
+                               /* Third arg, trigger finest TP. */
+                               lttng.finest("JUL FINEST tp fired");
+                       }
                        Thread.sleep(waitTime);
                }
 
index affb7eb6de55fc8dba91b6a0d79e086c814e693d..bd6a0e9b3dd701ac1677f7065e4350e28ef6cfde 100755 (executable)
@@ -30,13 +30,15 @@ JAVA_CP="$CURDIR:/usr/local/lib/lttng/java/liblttng-ust-jul.jar:/usr/lib/lttng/j
 
 TRACE_PATH=$(mktemp -d)
 
-NUM_TESTS=37
+NUM_TESTS=53
 
 source $TESTDIR/utils/utils.sh
 
 function run_app
 {
-       java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT >/dev/null 2>&1 &
+       local finest_tp=$1
+
+       java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $finest_tp >/dev/null 2>&1 &
 }
 
 function wait_apps
@@ -156,6 +158,47 @@ function test_jul_loglevel ()
        return $?
 }
 
+function test_jul_loglevel_multiple ()
+{
+       diag "Test JUL application with multiple loglevel"
+
+       create_lttng_session $SESSION_NAME $TRACE_PATH
+       enable_jul_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "JUL_INFO"
+       enable_jul_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "JUL_FINEST"
+       start_lttng_tracing $SESSION_NAME
+
+       # Run 5 times with a 1 second delay and fire two TP.
+       run_app 1
+       wait_apps
+
+       stop_lttng_tracing $SESSION_NAME
+       destroy_lttng_session $SESSION_NAME
+
+       # Validate test. Expecting all events times two.
+       trace_matches $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
+       if [ $? -ne 0 ]; then
+               return $?
+       fi
+
+       create_lttng_session $SESSION_NAME $TRACE_PATH
+       enable_jul_lttng_event_loglevel $SESSION_NAME '*' "JUL_INFO"
+       enable_jul_lttng_event_loglevel $SESSION_NAME '*' "JUL_FINEST"
+       start_lttng_tracing $SESSION_NAME
+
+       # Run 5 times with a 1 second delay and fire two TP.
+       run_app 1
+       wait_apps
+
+       stop_lttng_tracing $SESSION_NAME
+       destroy_lttng_session $SESSION_NAME
+
+       # Validate test. Expecting all events times two.
+       trace_matches $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
+       if [ $? -ne 0 ]; then
+               return $?
+       fi
+}
+
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
@@ -172,6 +215,7 @@ skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
 
        tests=(
                test_jul_loglevel
+               test_jul_loglevel_multiple
                test_jul_before_start
                test_jul_after_start
        )
This page took 0.035892 seconds and 4 git commands to generate.