From ec8f26de70d4862d4fad73f844c19fabf30b19c8 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 17 Jan 2012 16:20:18 -0500 Subject: [PATCH] Fix UST tests if lttng-ust is not available Signed-off-by: David Goulet --- tests/Makefile.am | 25 ++++++++++++++++--------- tests/lttng/run-ust-global-tests.sh | 5 +++++ tests/runall.sh | 5 +++++ tests/ust-nevents/run | 13 ++++++++++--- tests/ust-nprocesses/run | 13 ++++++++++--- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 27c7c7744..95acd640b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/lttng/run-ust-global-tests.sh b/tests/lttng/run-ust-global-tests.sh index 135c8a2b4..a99ff43b3 100755 --- a/tests/lttng/run-ust-global-tests.sh +++ b/tests/lttng/run-ust-global-tests.sh @@ -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 diff --git a/tests/runall.sh b/tests/runall.sh index eadeeb912..08b390483 100755 --- a/tests/runall.sh +++ b/tests/runall.sh @@ -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 diff --git a/tests/ust-nevents/run b/tests/ust-nevents/run index 9fbc8d805..301b70d97 100755 --- a/tests/ust-nevents/run +++ b/tests/ust-nevents/run @@ -15,11 +15,11 @@ # 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 diff --git a/tests/ust-nprocesses/run b/tests/ust-nprocesses/run index dcaa379ed..4c82eba12 100755 --- a/tests/ust-nprocesses/run +++ b/tests/ust-nprocesses/run @@ -15,12 +15,12 @@ # 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 -- 2.34.1