[lttng-dev] [PATCH lttng-tools 1/5] Fix: tests: don't build dynamic lib tests if support disabled

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu May 12 20:08:43 UTC 2016


Fixes: #977

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 tests/regression/tools/health/Makefile.am        | 20 +++++++++++++-------
 tests/regression/ust/clock-override/Makefile.am  | 13 +++++++++++++
 tests/regression/ust/getcpu-override/Makefile.am | 14 ++++++++++++++
 tests/regression/ust/linking/Makefile.am         | 20 ++++++++++++++------
 tests/regression/ust/overlap/demo/Makefile.am    | 12 +++++++++++-
 tests/regression/ust/ust-dl/Makefile.am          | 19 ++++++++++++++++---
 tests/regression/ust/ust-dl/test_ust-dl          |  4 ++++
 7 files changed, 85 insertions(+), 17 deletions(-)

diff --git a/tests/regression/tools/health/Makefile.am b/tests/regression/tools/health/Makefile.am
index 643dd31..4d835f3 100644
--- a/tests/regression/tools/health/Makefile.am
+++ b/tests/regression/tools/health/Makefile.am
@@ -8,9 +8,17 @@ if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
 LIBS += -lc
 endif
 
+COPYSCRIPTS = test_thread_exit test_thread_stall test_tp_fail \
+	test_health.sh test_thread_ok
+dist_noinst_SCRIPTS = $(COPYSCRIPTS)
+
 if NO_SHARED
 # Do not build this test if shared libraries support was
 # explicitly disabled.
+
+EXTRA_DIST = health_exit.c health_stall.c health_fail.c \
+	health_check.c $(COPYSCRIPTS)
+
 else
 # In order to test the health check feature, the libhealth* libs
 # must be built as .so to be able to LD_PRELOAD them.
@@ -35,23 +43,21 @@ noinst_LTLIBRARIES = libhealthexit.la libhealthstall.la libhealthtpfail.la
 health_check_SOURCES = health_check.c $(UTILS)
 health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 		     $(top_builddir)/src/common/libcommon.la
-endif
 
-dist_noinst_SCRIPTS = test_thread_exit test_thread_stall test_tp_fail \
-		test_health.sh test_thread_ok
-EXTRA_DIST = test_thread_exit test_thread_stall test_tp_fail \
-		test_health.sh test_thread_ok
+EXTRA_DIST = $(COPYSCRIPTS)
+
+endif
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
+		for script in $(COPYSCRIPTS); do \
 			cp -f $(srcdir)/$$script $(builddir); \
 		done; \
 	fi
 
 clean-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
+		for script in $(COPYSCRIPTS); do \
 			rm -f $(builddir)/$$script; \
 		done; \
 	fi
diff --git a/tests/regression/ust/clock-override/Makefile.am b/tests/regression/ust/clock-override/Makefile.am
index 95065e0..cc4b02c 100644
--- a/tests/regression/ust/clock-override/Makefile.am
+++ b/tests/regression/ust/clock-override/Makefile.am
@@ -1,3 +1,14 @@
+if NO_SHARED
+# Do not build this test if shared libraries support was
+# explicitly disabled.
+
+CLEANFILES = lttng-ust-clock-override-test.so \
+	lttng-ust-clock-override-test.so.debug
+
+EXTRA_DIST = test_clock_override lttng-ust-clock-override-test.c
+
+else
+
 AM_CPPFLAGS = -I$(srcdir)
 
 # The rpath is necessary because libtool won't build a shared library
@@ -35,3 +46,5 @@ clean-local:
 			rm -f $(builddir)/$$script; \
 		done; \
 	fi
+
+endif
diff --git a/tests/regression/ust/getcpu-override/Makefile.am b/tests/regression/ust/getcpu-override/Makefile.am
index f1026ac..a7bdc86 100644
--- a/tests/regression/ust/getcpu-override/Makefile.am
+++ b/tests/regression/ust/getcpu-override/Makefile.am
@@ -1,3 +1,15 @@
+if NO_SHARED
+# Do not build this test if shared libraries support was
+# explicitly disabled.
+
+CLEANFILES = lttng-ust-getcpu-override-test.so \
+	lttng-ust-getcpu-override-test.so.debug
+
+EXTRA_DIST = test_getcpu_override run-getcpu-override \
+	lttng-ust-getcpu-override-test.c
+
+else
+
 AM_CPPFLAGS = -I$(srcdir)
 
 # The rpath is necessary because libtool won't build a shared library
@@ -35,3 +47,5 @@ clean-local:
 			rm -f $(builddir)/$$script; \
 		done; \
 	fi
+
+endif
diff --git a/tests/regression/ust/linking/Makefile.am b/tests/regression/ust/linking/Makefile.am
index 9f7ebec..1c80ae8 100644
--- a/tests/regression/ust/linking/Makefile.am
+++ b/tests/regression/ust/linking/Makefile.am
@@ -44,7 +44,16 @@ endif
 
 noinst_PROGRAMS = demo_builtin demo_static
 
-if !NO_SHARED
+COPYSCRIPTS = test_linking test_linking.py demo_preload
+noinst_SCRIPTS = $(COPYSCRIPTS)
+
+if NO_SHARED
+
+EXTRA_DIST = tp.c ust_tests_demo.h tp2.c ust_tests_demo2.h \
+	tp3.c ust_tests_demo3.h demo.c ust_tests_demo.h \
+	$(COPYSCRIPTS)
+
+else
 # Force the shared flag on the noinst libraries since they are
 # only built static by default
 FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \
@@ -79,21 +88,20 @@ if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
 demo_LDADD = -lc
 endif
 
-endif
+EXTRA_DIST = $(COPYSCRIPTS)
 
-noinst_SCRIPTS = test_linking test_linking.py demo_preload
-EXTRA_DIST = test_linking test_linking.py demo_preload
+endif
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
+		for script in $(COPYSCRIPTS); do \
 			cp -f $(srcdir)/$$script $(builddir); \
 		done; \
 	fi
 
 clean-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
+		for script in $(COPYSCRIPTS); do \
 			rm -f $(builddir)/$$script; \
 		done; \
 	fi
diff --git a/tests/regression/ust/overlap/demo/Makefile.am b/tests/regression/ust/overlap/demo/Makefile.am
index c5e9f92..15f5600 100644
--- a/tests/regression/ust/overlap/demo/Makefile.am
+++ b/tests/regression/ust/overlap/demo/Makefile.am
@@ -1,8 +1,17 @@
-AM_CFLAGS=-I$(srcdir)
 if NO_SHARED
 # Do not build this test if shared libraries support was
 # explicitly disabled.
+
+CLEANFILES = demo
+
+EXTRA_DIST = demo-trace demo.c ust_tests_demo.h \
+	tp3.c ust_tests_demo3.h tp2.c ust_tests_demo2.h \
+	tp.c ust_tests_demo.h
+
 else
+
+AM_CFLAGS=-I$(srcdir)
+
 # Force the shared flag on the noinst libraries since they are
 # only built static by default
 FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \
@@ -49,4 +58,5 @@ clean-local:
 			rm -f $(builddir)/$$script; \
 		done; \
 	fi
+
 endif
diff --git a/tests/regression/ust/ust-dl/Makefile.am b/tests/regression/ust/ust-dl/Makefile.am
index c12da16..bcd7001 100644
--- a/tests/regression/ust/ust-dl/Makefile.am
+++ b/tests/regression/ust/ust-dl/Makefile.am
@@ -1,3 +1,14 @@
+if NO_SHARED
+# Do not build this test if shared libraries support was
+# explicitly disabled.
+
+CLEANFILES = libfoo.so libfoo.so.debug prog
+
+EXTRA_DIST = test_ust-dl test_ust-dl.py libfoo.c libfoo.h \
+	prog.c
+
+else
+
 objcopy_verbose = $(objcopy_verbose_ at AM_V@)
 objcopy_verbose_ = $(objcopy_verbose_ at AM_DEFAULT_V@)
 objcopy_verbose_0 = @echo OBJCOPY $@;
@@ -13,8 +24,7 @@ libfoo_la_SOURCES = libfoo.c libfoo.h
 libfoo_la_LDFLAGS = -module -shared -avoid-version \
 		-rpath $(abs_builddir)
 
-noinst_SCRIPTS = test_ust-dl test_ust-dl.py
-EXTRA_DIST = test_ust-dl test_ust-dl.py
+CLEANFILES = libfoo.so libfoo.so.debug
 
 # Extract debug symbols
 libfoo.so.debug: libfoo.la
@@ -25,6 +35,9 @@ libfoo.so: libfoo.so.debug
 	@cp -f .libs/libfoo.so libfoo.so
 	$(objcopy_verbose)$(OBJCOPY) --strip-debug --add-gnu-debuglink=libfoo.so.debug libfoo.so
 
+noinst_SCRIPTS = test_ust-dl test_ust-dl.py
+EXTRA_DIST = test_ust-dl test_ust-dl.py
+
 all-local: libfoo.so
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
 		for script in $(EXTRA_DIST); do \
@@ -39,4 +52,4 @@ clean-local:
 		done; \
 	fi
 
-CLEANFILES = libfoo.so libfoo.so.debug
+endif
diff --git a/tests/regression/ust/ust-dl/test_ust-dl b/tests/regression/ust/ust-dl/test_ust-dl
index 9e80bb3..7b835dc 100755
--- a/tests/regression/ust/ust-dl/test_ust-dl
+++ b/tests/regression/ust/ust-dl/test_ust-dl
@@ -20,6 +20,10 @@ TESTDIR=${CURDIR}/../../..
 
 source $TESTDIR/utils/utils.sh
 
+if [ ! -x "$CURDIR/.libs/libfoo.so" ]; then
+	BAIL_OUT "No shared object generated"
+fi
+
 start_lttng_sessiond_notap
 
 python3 ${CURDIR}/test_ust-dl.py
-- 
2.1.4



More information about the lttng-dev mailing list