*.info
*.bz2
*.tar
+*.class
.dirstamp
configure
aclocal.m4
)
AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
+# Set compile flags to java include files if given. This is only used to
+# compile JUL tests.
+AC_ARG_WITH([java-jdk],
+ [AS_HELP_STRING([--with-java-jdk=DIR],[use the Java JDK in DIR. Ex : $JAVA_HOME.])],
+ [JAVA_JDK=$withval],
+ [JAVA_JDK=""]
+)
+AM_CONDITIONAL([HAVE_JAVA_JDK], [test $JAVA_JDK], [Java JDK path])
+AC_SUBST([JAVA_JDK])
+
+AS_IF([test $JAVA_JDK],[
+ AS_IF([test -d $JAVA_JDK],
+ [
+ AC_MSG_RESULT([using Java includes in $JAVA_SDK])
+ SUBDIRS=`find $JAVA_JDK/include -type d`
+ CPPFLAGS+=" "
+ CPPFLAGS+=`for x in $SUBDIRS; do echo -n "-I$x "; done`
+ CPPFLAGS+=" "
+ ],[AC_MSG_ERROR(Unable to find Java include files in $JAVA_JDK)]
+ )
+])
+
+# Check for the UST JUL jar file in the system. Hardcoded path is added here
+# since we have *no* idea where this could be installed. Note that this is only
+# used for JUL testing.
+AC_MSG_CHECKING(Java JUL UST jar file)
+java_jul_jar_path="/usr/local/lib/lttng/java/liblttng-ust-jul.jar"
+if test -f $java_jul_jar_path; then
+ build_java_jul=yes
+ AC_MSG_RESULT(found)
+else
+ build_java_jul=no
+ AC_MSG_RESULT(not found)
+fi
+AM_CONDITIONAL([BUILD_JAVA_JUL], [test "x$build_java_jul" = "xyes"])
+AC_SUBST([java_jul_jar_path])
+
AC_SYS_LARGEFILE
AC_PROG_CC
LT_INIT
tests/regression/ust/exit-fast/Makefile
tests/regression/ust/fork/Makefile
tests/regression/ust/libc-wrapper/Makefile
+ tests/regression/ust/java-jul/Makefile
tests/stress/Makefile
tests/unit/Makefile
tests/utils/Makefile
regression/ust/multi-session/test_multi_session
regression/ust/nprocesses/test_nprocesses
regression/ust/overlap/test_overlap
+regression/ust/java-jul/test_java_jul
regression/ust/test_event_basic
regression/ust/test_event_wildcard
if HAVE_LIBLTTNG_UST_CTL
SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session \
overlap buffers-pid linking daemon exit-fast fork libc-wrapper \
- periodical-metadata-flush
+ periodical-metadata-flush java-jul
EXTRA_DIST = test_event_basic test_event_wildcard
--- /dev/null
+/*
+ * Copyright (C) 2013 - David Goulet <dgoulet@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.
+ */
+
+import java.lang.Integer;
+import java.util.logging.Logger;
+
+import org.lttng.ust.jul.LTTngAgent;
+
+public class JTestLTTng
+{
+ private static LTTngAgent lttngAgent;
+
+ public static void main(String args[]) throws Exception
+ {
+ Logger lttng = Logger.getLogger("JTestLTTng");
+ int nrIter = Integer.parseInt(args[0]);
+ int waitTime = Integer.parseInt(args[1]);
+
+ lttngAgent = LTTngAgent.getLTTngAgent();
+
+ for (int iter = 0; iter < nrIter; iter++) {
+ lttng.info("JUL tp fired!");
+ Thread.sleep(waitTime);
+ }
+
+ lttngAgent.dispose();
+ }
+}
--- /dev/null
+if BUILD_JAVA_JUL
+
+noinst_SCRIPTS = test_java_jul
+EXTRA_DIST = test_java_jul
+
+if HAVE_JAVA_JDK
+JCC=$(JAVA_JDK)/bin/javac
+else
+JCC=javac
+endif
+
+JUL_JAR_FILE=$(java_jul_jar_path)
+
+all-local: JTestLTTng.class
+
+%.class: %.java
+ $(JCC) -d "$(builddir)" -cp "$(JUL_JAR_FILE):." $<
+
+JTestLTTng.class: JTestLTTng.java
+
+all-local:
+ @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+ for script in $(EXTRA_DIST); do \
+ cp -f $(srcdir)/$$script $(builddir); \
+ done; \
+ fi
+
+clean-local:
+ rm -f *.class
+ @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+ for script in $(EXTRA_DIST); do \
+ rm -f $(builddir)/$$script; \
+ done; \
+ fi
+
+endif # BUILD_JAVA_JUL
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2013 David Goulet <dgoulet@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="Java JUL support"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+NR_ITER=6
+NR_MSEC_WAIT=1000
+TESTAPP_NAME="JTestLTTng"
+TESTAPP_BIN="$TESTAPP_NAME.java"
+TESTAPP_PATH="$CURDIR/$TESTAPP_NAME"
+SESSION_NAME="jul"
+EVENT_NAME="JTestLTTng"
+JAVA_CP="$CURDIR:/usr/local/lib/lttng/java/liblttng-ust-jul.jar:/usr/lib/lttng/java/liblttng-ust-jul.jar"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=16
+
+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 &
+}
+
+function wait_apps
+{
+ while [ -n "$(pidof java)" ]; do
+ sleep 0.5
+ done
+ pass "Wait for applications to end"
+}
+
+# MUST set TESTDIR before calling those functions
+
+function test_jul_before_start ()
+{
+ diag "Test JUL application BEFORE tracing starts"
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_jul_lttng_event $SESSION_NAME $EVENT_NAME
+
+ # Run 5 times with a 1 second delay
+ run_app
+
+ start_lttng_tracing $SESSION_NAME
+
+ wait_apps
+
+ stop_lttng_tracing $SESSION_NAME
+ destroy_lttng_session $SESSION_NAME
+}
+
+function test_jul_after_start ()
+{
+ diag "Test JUL application AFTER tracing starts"
+
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_jul_lttng_event $SESSION_NAME $EVENT_NAME
+ start_lttng_tracing $SESSION_NAME
+
+ # Run 5 times with a 1 second delay
+ run_app
+
+ wait_apps
+
+ stop_lttng_tracing $SESSION_NAME
+ destroy_lttng_session $SESSION_NAME
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+if [ ! -f "$TESTAPP_PATH.class" ]; then
+ withapp=0
+else
+ withapp=1
+fi
+
+skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
+{
+ start_lttng_sessiond
+
+ tests=(
+ test_jul_before_start
+ test_jul_after_start
+ )
+
+ for fct_test in ${tests[@]};
+ do
+ ${fct_test}
+
+ # Validate test
+ validate_trace $EVENT_NAME $TRACE_PATH
+ if [ $? -eq 0 ]; then
+ # Only delete if successful
+ rm -rf $TRACE_PATH
+ else
+ break
+ fi
+ done
+
+ stop_lttng_sessiond
+}
ok $? "Enable event $event_name for session $sess_name"
}
+function enable_jul_lttng_event()
+{
+ sess_name=$1
+ event_name="$2"
+ channel_name=$3
+
+ if [ -z $channel_name ]; then
+ # default channel if none specified
+ chan=""
+ else
+ chan="-c $channel_name"
+ fi
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -j >/dev/null 2>&1
+ ok $? "Enable JUL event $event_name for session $sess_name"
+}
+
function enable_ust_lttng_event_filter()
{
sess_name="$1"