Fix UST tests if lttng-ust is not available
authorDavid Goulet <dgoulet@efficios.com>
Tue, 17 Jan 2012 21:20:18 +0000 (16:20 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 17 Jan 2012 21:20:18 +0000 (16:20 -0500)
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/Makefile.am
tests/lttng/run-ust-global-tests.sh
tests/runall.sh
tests/ust-nevents/run
tests/ust-nprocesses/run

index 27c7c7744658fa73d574fe96d4189ce9a3c8bf07..95acd640b7fa56a8b16e22c105a635b2a6c549ff 100644 (file)
@@ -1,18 +1,16 @@
-SUBDIRS = . ust-nevents ust-nprocesses
+SUBDIRS = .
 
 AM_CFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/libkernelctl \
                  -I$(top_srcdir)/liblttngctl -g -Wall -lurcu -lurcu-cds
 
-EXTRA_DIST = runall.sh lttng/runall.sh lttng/run-kernel-tests.sh lttng/run-ust-tests.sh
+EXTRA_DIST = runall.sh lttng/runall.sh lttng/run-kernel-tests.sh
 
-noinst_PROGRAMS = test_sessions test_kernel_data_trace test_ust_data_trace \
-                                 kernel_all_events_basic kernel_event_basic \
-                                 ust_global_event_basic ust_global_all_events_basic
+noinst_PROGRAMS = test_sessions test_kernel_data_trace \
+                                 kernel_all_events_basic kernel_event_basic
 
 UTILS=utils.h
 SESSIONS=$(top_srcdir)/lttng-sessiond/session.c
 KERN_DATA_TRACE=$(top_srcdir)/lttng-sessiond/trace-kernel.c
-UST_DATA_TRACE=$(top_srcdir)/lttng-sessiond/trace-ust.c
 LIBLTTNG=$(top_srcdir)/liblttngctl/lttngctl.c \
                 $(top_srcdir)/liblttng-sessiond-comm/lttng-sessiond-comm.c
 
@@ -22,17 +20,26 @@ test_sessions_LDADD = $(top_builddir)/common/libcommon.la \
 
 test_kernel_data_trace_SOURCES = test_kernel_data_trace.c $(UTILS) $(KERN_DATA_TRACE)
 
-test_ust_data_trace_SOURCES = test_ust_data_trace.c $(UTILS) $(UST_DATA_TRACE)
-test_ust_data_trace_LDADD = $(top_builddir)/common/libcommon.la \
-                                                       $(top_builddir)/liblttng-ht/liblttng-ht.la
 
 kernel_all_events_basic_SOURCES = lttng/kernel_all_events_basic.c $(UTILS) $(LIBLTTNG)
 
 kernel_event_basic_SOURCES = lttng/kernel_event_basic.c $(UTILS) $(LIBLTTNG)
 
+if HAVE_LIBLTTNG_UST_CTL
+SUBDIRS += ust-nevents ust-nprocesses
+EXTRA_DIST += lttng/run-ust-tests.sh
+noinst_PROGRAMS += ust_global_event_basic ust_global_all_events_basic test_ust_data_trace
+
+UST_DATA_TRACE=$(top_srcdir)/lttng-sessiond/trace-ust.c
+
+test_ust_data_trace_SOURCES = test_ust_data_trace.c $(UTILS) $(UST_DATA_TRACE)
+test_ust_data_trace_LDADD = $(top_builddir)/common/libcommon.la \
+                                                       $(top_builddir)/liblttng-ht/liblttng-ht.la
+
 ust_global_all_events_basic_SOURCES = lttng/ust_global_all_events_basic.c $(UTILS) $(LIBLTTNG)
 
 ust_global_event_basic_SOURCES = lttng/ust_global_event_basic.c $(UTILS) $(LIBLTTNG)
+endif # HAVE_LIBLTTNG_UST_CTL
 
 check-am:
        ./runall.sh
index 135c8a2b4311f88c35f09e428ab1557a16eaa86c..a99ff43b307b3be917f132d81eae62f571ebea82 100755 (executable)
@@ -13,6 +13,11 @@ function start_tests ()
 {
     for bin in ${tests[@]};
     do
+               if [ ! -e $bin ]; then
+                       echo -e "$bin not found, passing"
+                       continue
+               fi
+
         ./$bin $tmpdir
         # Test must return 0 to pass.
         if [ $? -ne 0 ]; then
index eadeeb912e6bc07df0fa18d990ed5c6a812ce094..08b3904838d1408e54a7c2474cc952be27349e9d 100755 (executable)
@@ -35,6 +35,11 @@ fi
 
 for bin in ${test_suite[@]};
 do
+       if [ ! -e $bin ]; then
+               echo -e "$bin not found, passing"
+               continue
+       fi
+
        ./$bin
        # Test must return 0 to pass.
        if [ $? -ne 0 ]; then
index 9fbc8d80536b7c867c3372f0e75deeff6091c453..301b70d970bf1f3c057f99999dedefaa7e169a9b 100755 (executable)
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-TESTDIR=$(dirname $0)/..
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/..
 NR_ITER=100
 SESSION_NAME="ust-nevents"
 EVENT_NAME="ust_gen_nevents:tptest"
-TRACE_PATH=$(mktemp -d)
 
 source $TESTDIR/utils.sh
 
@@ -27,6 +27,13 @@ echo -e "\n-----------------------------------"
 echo -e "UST tracer - Generate $NR_ITER events"
 echo -e "-------------------------------------"
 
+if [ ! -e "$CURDIR/gen-nevents" ]; then
+       echo -e "No UST nevents binary detected. Passing."
+       exit 0
+fi
+
+TRACE_PATH=$(mktemp -d)
+
 # MUST set TESTDIR before calling those functions
 
 create_lttng_session $SESSION_NAME $TRACE_PATH
@@ -35,7 +42,7 @@ enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 start_tracing $SESSION_NAME
 
 # Start test
-./$(dirname $0)/gen-nevents $NR_ITER
+./$CURDIR/gen-nevents $NR_ITER
 
 stop_tracing $SESSION_NAME
 destroy_lttng_session $SESSION_NAME
index dcaa379ed1e8f4397d1fb249fcd39c3a9582c536..4c82eba12fdb4b5596370e54dbdc7aba72f984ec 100755 (executable)
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-TESTDIR=$(dirname $0)/..
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/..
 NR_ITER=100
 TEST_BIN_NAME="gen-events-time"
 SESSION_NAME="ust-nprocesses"
 EVENT_NAME="ust_gen_event:tptest"
-TRACE_PATH=$(mktemp -d)
 TEST_WAIT_SEC=3
 
 source $TESTDIR/utils.sh
@@ -29,13 +29,18 @@ echo -e "\n-------------------------------------"
 echo -e "UST tracer - Generate $NR_ITER process"
 echo -e "---------------------------------------"
 
+if [ ! -e "$CURDIR/$TEST_BIN_NAME" ]; then
+       echo -e "No UST $TEST_BIN_NAME binary detected. Passing."
+       exit 0
+fi
+
 # MUST set TESTDIR before calling those functions
 
 # Start test for 1000 seconds
 
 for i in `seq 1 $NR_ITER`
 do
-       ./$(dirname $0)/$TEST_BIN_NAME 1000 >/dev/null 2>&1 &
+       ./$CURDIR/$TEST_BIN_NAME 1000 >/dev/null 2>&1 &
 done
 
 echo -n "Validating registered apps: "
@@ -48,6 +53,8 @@ else
        echo -e "\e[1;32mOK\e[0m"
 fi
 
+TRACE_PATH=$(mktemp -d)
+
 create_lttng_session $SESSION_NAME $TRACE_PATH
 
 enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
This page took 0.041465 seconds and 4 git commands to generate.