Tests: Java agent: Add configure switches to enable tests
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 6 Aug 2015 16:39:13 +0000 (12:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 8 Sep 2015 13:30:06 +0000 (09:30 -0400)
This patch adds the switches --enable-test-java-agent-(jul|log4j|all) to
the configure script, the tests now need to be explicitly enabled and
their dependencies are only checked if so.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/regression/ust/java-jul/Makefile.am
tests/regression/ust/java-log4j/Makefile.am

index 6b3f785ec87a4f8130f5860c538573accbe73396..019bf123bdba84a9b35fea6888a325beecf15c37 100644 (file)
@@ -131,6 +131,25 @@ AC_ARG_WITH([lttng-system-rundir],
        [LTTNG_SYSTEM_RUNDIR="/var/run/lttng"])
 AC_SUBST([LTTNG_SYSTEM_RUNDIR])
 
+AC_ARG_ENABLE([test-java-agent-jul],
+       [AS_HELP_STRING([--enable-test-java-agent-jul],[enable the LTTng UST Java agent JUL tests [default=no]])],
+       [test_java_agent_jul=$enableval],
+       [test_java_agent_jul=no]
+)
+
+AC_ARG_ENABLE([test-java-agent-log4j],
+        [AS_HELP_STRING([--enable-test-java-agent-log4j],[enable the LTTng UST Java agent Log4j tests [default=no]])],
+        [test_java_agent_log4j=$enableval],
+        [test_java_agent_log4j=no]
+)
+
+AC_ARG_ENABLE([test-java-agent-all],
+        [AS_HELP_STRING([--enable-test-java-agent-all],[enable all the LTTng UST Java agent tests [default=no]])],
+        [test_java_agent_jul=$enableval
+         test_java_agent_log4j=$enableval],
+        [:]
+)
+
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
@@ -355,44 +374,45 @@ AX_CONFIG_FEATURE(
 )
 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
 
-AX_JAVA_OPTIONS
-AX_PROG_JAVAC
-AX_PROG_JAVA
-AX_PROG_JAR
+AM_CONDITIONAL([TEST_JAVA_JUL_AGENT], [test "x$test_java_agent_jul" = "xyes"])
+AM_CONDITIONAL([TEST_JAVA_LOG4J_AGENT], [test "x$test_java_agent_log4j" = "xyes"])
 
-AX_CHECK_CLASSPATH
+if test "x$test_java_agent_jul" = "xyes" || test "x$test_java_agent_log4j" = "xyes"; then
+       AX_JAVA_OPTIONS
+       AX_PROG_JAVAC
+       AX_PROG_JAVA
+       AX_PROG_JAR
 
-# Check for Java UST agent common class first
-AX_CHECK_CLASS(org.lttng.ust.agent.AbstractLttngAgent)
-if test "x$ac_cv_class_org_lttng_ust_agent_AbstractLttngAgent" = "xyes"; then
-       java_agent_common=yes
-else
-       java_agent_common=no
-fi
-
-# If the common class is available, test for each agent
-if test "x$java_agent_common" = "xyes"; then
-       # Check for JUL
-       AX_CHECK_CLASS(org.lttng.ust.agent.jul.LttngLogHandler)
-       AX_CHECK_CLASS(org.lttng.ust.agent.log4j.LttngLogAppender)
-       AX_CHECK_CLASS(org.apache.log4j.Logger)
+       AX_CHECK_CLASSPATH
 
-       build_java_jul_agent=no
-       if test "x$ac_cv_class_org_lttng_ust_agent_jul_LttngLogHandler" = "xyes"; then
-               build_java_jul_agent=yes
+       # Check for Java UST agent common class first
+       AX_CHECK_CLASS(org.lttng.ust.agent.AbstractLttngAgent)
+       if test "x$ac_cv_class_org_lttng_ust_agent_AbstractLttngAgent" = "xno"; then
+               AC_MSG_ERROR([The UST Java agent common class was not found. Please specify the location of the jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/lttng-ust-agent-common.jar"])
        fi
 
-       build_java_log4j_agent=no
-       if test "x$ac_cv_class_org_lttng_ust_agent_log4j_LttngLogAppender" = "xyes"; then
-               if test "x$ac_cv_class_org_apache_log4j_Logger" = "xyes"; then
-                       build_java_log4j_agent=yes
+       if test "x$test_java_agent_jul" = "xyes"; then
+               # Check for JUL agent class
+               AX_CHECK_CLASS(org.lttng.ust.agent.jul.LttngLogHandler)
+               if test "x$ac_cv_class_org_lttng_ust_agent_jul_LttngLogHandler" = "xno"; then
+                       AC_MSG_ERROR([The UST Java agent JUL class was not found. Please specify the location of the jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/lttng-ust-agent-jul.jar"])
                fi
        fi
 
-fi
+       if test "x$test_java_agent_log4j" = "xyes"; then
+               # Check for Log4j agent class
+               AX_CHECK_CLASS(org.lttng.ust.agent.log4j.LttngLogAppender)
+               if test "x$ac_cv_class_org_lttng_ust_agent_log4j_LttngLogAppender" = "xno"; then
+                       AC_MSG_ERROR([The UST Java agent Log4j class was not found. Please specify the location of the jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/lttng-ust-agent-log4j.jar"])
+               fi
 
-AM_CONDITIONAL([BUILD_JAVA_JUL_AGENT], [test "x$build_java_jul_agent" = "xyes"])
-AM_CONDITIONAL([BUILD_JAVA_LOG4J_AGENT], [test "x$build_java_log4j_agent" = "xyes"])
+               # Check for Log4j class
+               AX_CHECK_CLASS(org.apache.log4j.Logger)
+               if test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"; then
+                       AC_MSG_ERROR([The Log4j class was not found. Please specify the location of the jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/log4j.jar"])
+               fi
+       fi
+fi
 
 AC_SYS_LARGEFILE
 
@@ -571,6 +591,22 @@ AS_IF([test "x$lttng_ust_support" = "xyes"],[
        AS_ECHO("Disabled")
 ])
 
+# LTTng UST Java agent JUL tests enabled/disabled
+AS_ECHO_N("LTTng-UST Java agent JUL tests: ")
+AS_IF([test "x$test_java_agent_jul" = "xyes"],[
+       AS_ECHO("Enabled")
+],[
+       AS_ECHO("Disabled")
+])
+
+# LTTng UST Java agent Log4j tests enabled/disabled
+AS_ECHO_N("LTTng-UST Java agent Log4j tests: ")
+AS_IF([test "x$test_java_agent_log4j" = "xyes"],[
+       AS_ECHO("Enabled")
+],[
+       AS_ECHO("Disabled")
+])
+
 #Python binding enabled/disabled
 AS_ECHO_N("Python binding: ")
 AS_IF([test "x${enable_python_binding:-yes}" = xyes], [
index 877237fffd02d47d37c65630f18b226e34a51836..b0a04f30c5b603bed6eec3e53d8de3c031ecd9e5 100644 (file)
@@ -3,9 +3,9 @@ JAVAROOT = .
 noinst_SCRIPTS = test_java_jul JTestLTTng.java
 EXTRA_DIST = test_java_jul JTestLTTng.java
 
-if BUILD_JAVA_JUL_AGENT
+if TEST_JAVA_JUL_AGENT
 dist_noinst_JAVA = JTestLTTng.java
-endif # BUILD_JAVA_JUL_AGENT
+endif # TEST_JAVA_JUL_AGENT
 
 all-local: static_file
 
index 42daab81b85d9d51c908a8c97de759e5950ab6d1..60d5c37f076d592ee54813cfe536e4f1d0ef62ca 100644 (file)
@@ -3,9 +3,9 @@ JAVAROOT = .
 noinst_SCRIPTS = test_java_log4j JTestLTTng.java
 EXTRA_DIST = test_java_log4j JTestLTTng.java
 
-if BUILD_JAVA_LOG4J_AGENT
+if TEST_JAVA_LOG4J_AGENT
 dist_noinst_JAVA = JTestLTTng.java
-endif # BUILD_JAVA_LOG4J_AGENT
+endif # TEST_JAVA_LOG4J_AGENT
 
 all-local: static_file
 
This page took 0.02849 seconds and 4 git commands to generate.