From cdbfb1b9cd74b6f6da7082482b1d6c3d97605818 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 12 May 2016 16:08:43 -0400 Subject: [PATCH] Fix: tests: don't build dynamic lib tests if support disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: #977 Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- tests/regression/tools/health/Makefile.am | 20 ++++++++++++------- .../regression/ust/clock-override/Makefile.am | 13 ++++++++++++ .../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 643dd31d2..4d835f3df 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 95065e0ed..cc4b02c1e 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 f1026ac02..a7bdc86cd 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 9f7ebecb9..1c80ae839 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 c5e9f92d5..15f5600d6 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 c12da16d0..bcd700109 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_@AM_V@) objcopy_verbose_ = $(objcopy_verbose_@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 9e80bb39c..7b835dcbd 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.34.1