[lttng-dev] [PATCH babeltrace] Fix test: don't link tests directly with plugins

Michael Jeanson mjeanson at efficios.com
Mon Aug 28 18:48:58 UTC 2017


Move the debug-info code to a convenience library that is then used by
both the plugin and the test code. This fixes build with static
libraries disabled where it's not possible to link directly the plugin
shared object which is a module.

Reviewed-by: Julien Desfossez <jdesfossez at efficios.com>
Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 plugins/lttng-utils/Makefile.am | 28 ++++++++++++++++------------
 tests/plugins/Makefile.am       | 18 ++++++++++++------
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/plugins/lttng-utils/Makefile.am b/plugins/lttng-utils/Makefile.am
index 72c7331..f826292 100644
--- a/plugins/lttng-utils/Makefile.am
+++ b/plugins/lttng-utils/Makefile.am
@@ -1,36 +1,40 @@
 AM_CPPFLAGS += -I$(top_srcdir)/plugins \
 	    -I$(top_srcdir)/plugins/libctfcopytrace
 
-SUBDIRS = .
+noinst_LTLIBRARIES = libdebug-info.la
+libdebug_info_la_SOURCES = \
+	bin-info.c \
+	bin-info.h \
+	crc32.c \
+	crc32.h \
+	debug-info.c \
+	debug-info.h \
+	dwarf.c \
+	dwarf.h \
+	logging.c \
+	logging.h
 
 plugindir = "$(PLUGINSDIR)"
 plugin_LTLIBRARIES = babeltrace-plugin-lttng-utils.la
 
 babeltrace_plugin_lttng_utils_la_SOURCES = \
 	plugin.c \
-	debug-info.h \
-	debug-info.c \
-	bin-info.c \
-	dwarf.c \
-	crc32.c \
 	utils.c \
 	copy.c \
-	crc32.h \
-	debug-info.h \
-	dwarf.h \
-	bin-info.h \
 	utils.h \
 	copy.h \
-	logging.c \
 	logging.h
 
+babeltrace_plugin_lttng_utils_la_LIBADD = \
+	libdebug-info.la
+
 babeltrace_plugin_lttng_utils_la_LDFLAGS = \
 	$(LT_NO_UNDEFINED) \
 	-avoid-version -module \
 	$(ELFUTILS_LIBS)
 
 if !ENABLE_BUILT_IN_PLUGINS
-babeltrace_plugin_lttng_utils_la_LIBADD = \
+babeltrace_plugin_lttng_utils_la_LIBADD += \
 	$(top_builddir)/lib/libbabeltrace.la \
 	$(top_builddir)/common/libbabeltrace-common.la \
 	$(top_builddir)/logging/libbabeltrace-logging.la \
diff --git a/tests/plugins/Makefile.am b/tests/plugins/Makefile.am
index e34e66a..ffea78b 100644
--- a/tests/plugins/Makefile.am
+++ b/tests/plugins/Makefile.am
@@ -20,14 +20,20 @@ LOG_DRIVER_FLAGS='--merge'
 TESTS = test-utils-muxer-complete
 
 if ENABLE_DEBUG_INFO
-test_dwarf_LDFLAGS = -static
-test_dwarf_LDADD = $(LIBTAP) \
-	$(top_builddir)/plugins/lttng-utils/babeltrace-plugin-lttng-utils.la
+test_dwarf_LDADD = \
+	$(top_builddir)/plugins/lttng-utils/libdebug-info.la \
+	$(top_builddir)/logging/libbabeltrace-logging.la \
+	$(top_builddir)/common/libbabeltrace-common.la \
+	$(ELFUTILS_LIBS) \
+	$(LIBTAP)
 test_dwarf_SOURCES = test_dwarf.c
 
-test_bin_info_LDFLAGS = -static
-test_bin_info_LDADD = $(LIBTAP) \
-	$(top_builddir)/plugins/lttng-utils/babeltrace-plugin-lttng-utils.la
+test_bin_info_LDADD = \
+	$(top_builddir)/plugins/lttng-utils/libdebug-info.la \
+	$(top_builddir)/logging/libbabeltrace-logging.la \
+	$(top_builddir)/common/libbabeltrace-common.la \
+	$(ELFUTILS_LIBS) \
+	$(LIBTAP)
 test_bin_info_SOURCES = test_bin_info.c
 
 noinst_PROGRAMS += test_dwarf test_bin_info
-- 
2.7.4



More information about the lttng-dev mailing list