From 149bc52e92f860f992d02ca19371ca8d8321f3df Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Tue, 8 Aug 2017 16:02:35 -0400 Subject: [PATCH] Re-enable the bin-info and dward tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit During the development of the debug-info plugin, the old tests were disabled. Re-adapt them to the new tree and re-enable them in the test suite. Reported-by: Michael Jeanson Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- configure.ac | 4 ++-- tests/lib/Makefile.am | 23 ------------------- tests/plugins/Makefile.am | 19 ++++++++++++++- tests/{lib => plugins}/test_bin_info.c | 10 ++++---- .../test_bin_info_complete.in | 0 tests/{lib => plugins}/test_dwarf.c | 2 +- tests/{lib => plugins}/test_dwarf_complete.in | 0 7 files changed, 26 insertions(+), 32 deletions(-) rename tests/{lib => plugins}/test_bin_info.c (96%) rename tests/{lib => plugins}/test_bin_info_complete.in (100%) rename tests/{lib => plugins}/test_dwarf.c (99%) rename tests/{lib => plugins}/test_dwarf_complete.in (100%) diff --git a/configure.ac b/configure.ac index 6625b58b..cd24ae42 100644 --- a/configure.ac +++ b/configure.ac @@ -728,14 +728,14 @@ AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy]) AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read]) AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer]) -AC_CONFIG_FILES([tests/lib/test_bin_info_complete], [chmod +x tests/lib/test_bin_info_complete]) AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete]) -AC_CONFIG_FILES([tests/lib/test_dwarf_complete], [chmod +x tests/lib/test_dwarf_complete]) AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete]) AC_CONFIG_FILES([tests/lib/writer/bt_python_helper.py]) AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_empty_packet.py]) AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_no_packet_context.py]) AC_CONFIG_FILES([tests/plugins/test-utils-muxer-complete], [chmod +x tests/plugins/test-utils-muxer-complete]) +AC_CONFIG_FILES([tests/plugins/test_dwarf_complete], [chmod +x tests/plugins/test_dwarf_complete]) +AC_CONFIG_FILES([tests/plugins/test_bin_info_complete], [chmod +x tests/plugins/test_bin_info_complete]) AS_IF([test "x$enable_python" = xyes], [AC_CONFIG_FILES([tests/bindings/python/bt2/testall.sh], [chmod +x tests/bindings/python/bt2/testall.sh])] diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index 511b8f37..2bcc630d 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -51,24 +51,6 @@ test_bt_notification_iterator_SOURCES = test_bt_notification_iterator.c check_SCRIPTS = test_ctf_writer_complete -#FIXME -#if ENABLE_DEBUG_INFO -#test_dwarf_LDFLAGS = -static -#test_dwarf_LDADD = $(LIBTAP) \ -# $(top_builddir)/lib/libbabeltrace.la \ -# $(top_builddir)/lib/libdebug-info.la -#test_dwarf_SOURCES = test_dwarf.c - -#test_bin_info_LDFLAGS = -static -#test_bin_info_LDADD = $(LIBTAP) \ -# $(top_builddir)/lib/libbabeltrace.la \ -# $(top_builddir)/lib/libdebug-info.la -#test_bin_info_SOURCES = test_bin_info.c - -#noinst_PROGRAMS += test_dwarf test_bin_info -#check_SCRIPTS += test_dwarf_complete test_bin_info_complete -#endif - LOG_DRIVER_FLAGS='--merge' LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/config/tap-driver.sh @@ -83,11 +65,6 @@ TESTS = test_bitfield \ test_cc_prio_map \ test_bt_notification_iterator -if ENABLE_DEBUG_INFO -TESTS += test_dwarf_complete \ - test_bin_info_complete -endif - if ENABLE_PYTHON_BINDINGS TESTS += writer/test_ctf_writer_no_packet_context.py \ diff --git a/tests/plugins/Makefile.am b/tests/plugins/Makefile.am index 867ddd96..e34e66a6 100644 --- a/tests/plugins/Makefile.am +++ b/tests/plugins/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS += -I$(top_srcdir)/tests/utils +AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(top_srcdir)/plugins LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la COMMON_TEST_LDADD = $(LIBTAP) \ @@ -18,3 +18,20 @@ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/config/tap-driver.sh 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_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_SOURCES = test_bin_info.c + +noinst_PROGRAMS += test_dwarf test_bin_info +check_SCRIPTS += test_dwarf_complete test_bin_info_complete +TESTS += test_dwarf_complete \ + test_bin_info_complete +endif diff --git a/tests/lib/test_bin_info.c b/tests/plugins/test_bin_info.c similarity index 96% rename from tests/lib/test_bin_info.c rename to tests/plugins/test_bin_info.c index fd9e4f1c..f95cf0d7 100644 --- a/tests/lib/test_bin_info.c +++ b/tests/plugins/test_bin_info.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include "tap/tap.h" #define NR_TESTS 36 @@ -65,7 +65,7 @@ void test_bin_info_build_id(const char *data_dir) snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_BUILD_ID); - bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true); + bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test setting build_id */ @@ -114,7 +114,7 @@ void test_bin_info_debug_link(const char *data_dir) snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_DEBUG_LINK); - bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true); + bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test setting debug link */ @@ -163,7 +163,7 @@ void test_bin_info_elf(const char *data_dir) snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_ELF); - bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true); + bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test function name lookup (with ELF) */ @@ -204,7 +204,7 @@ void test_bin_info(const char *data_dir) snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME); - bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true); + bin = bin_info_create(path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test bin_info_has_address */ diff --git a/tests/lib/test_bin_info_complete.in b/tests/plugins/test_bin_info_complete.in similarity index 100% rename from tests/lib/test_bin_info_complete.in rename to tests/plugins/test_bin_info_complete.in diff --git a/tests/lib/test_dwarf.c b/tests/plugins/test_dwarf.c similarity index 99% rename from tests/lib/test_dwarf.c rename to tests/plugins/test_dwarf.c index 90c1441e..8bae3d0b 100644 --- a/tests/lib/test_dwarf.c +++ b/tests/plugins/test_dwarf.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "tap/tap.h" #define NR_TESTS 15 diff --git a/tests/lib/test_dwarf_complete.in b/tests/plugins/test_dwarf_complete.in similarity index 100% rename from tests/lib/test_dwarf_complete.in rename to tests/plugins/test_dwarf_complete.in -- 2.34.1