From: Michael Jeanson Date: Thu, 9 May 2019 15:09:08 +0000 (-0400) Subject: tests: Build new x86_64-linux-gnu debug-info artifacts X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=6a2847334d16012b9cfbf11b08aac5535ab3153a tests: Build new x86_64-linux-gnu debug-info artifacts Build new debug info tests artifacts using the Makefile and namespace them and the related tests with 'x86_64-linux-gnu'. This will allow adding artifacts from different architectures to improve the test coverage. Signed-off-by: Michael Jeanson Change-Id: I97bd5052e9c3537f625581d21723e848c2a373b7 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1344 Tested-by: jenkins Reviewed-by: Philippe Proulx Reviewed-by: Francis Deslauriers --- diff --git a/.gitignore b/.gitignore index 7ee4af8b..e1c08283 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,6 @@ /tests/bin/intersection/test_intersection /tests/bin/test_packet_seq_num /tests/bin/test_trace_read -/tests/lib/test_bin_info -/tests/lib/test_bin_info_complete /tests/lib/test_bitfield /tests/lib/test_bt_ctf_field_type_validation /tests/lib/test_bt_objects @@ -20,8 +18,6 @@ /tests/lib/test_trace_ir_ref /tests/lib/test_ctf_writer /tests/lib/test_ctf_writer_complete -/tests/lib/test_dwarf -/tests/lib/test_dwarf_complete /tests/lib/test_ir_visit /tests/lib/test_trace_listener /tests/lib/test_plugin @@ -37,9 +33,9 @@ /tests/plugins/test-utils-muxer /tests/plugins/test_utils_muxer_complete /tests/plugins/test_lttng_utils_debug_info -/tests/plugins/test_bin_info_complete +/tests/plugins/test_bin_info_x86_64-linux-gnu /tests/plugins/test_bin_info -/tests/plugins/test_dwarf_complete +/tests/plugins/test_dwarf_x86_64-linux-gnu /tests/plugins/test_dwarf /tests/plugins/ctf/test_ctf_plugin /tests/utils/common.sh diff --git a/configure.ac b/configure.ac index 9cf24c97..0587dab5 100644 --- a/configure.ac +++ b/configure.ac @@ -805,8 +805,8 @@ AC_CONFIG_FILES([tests/lib/ctf-writer/test_ctf_writer], [chmod +x tests/lib/ctf- AC_CONFIG_FILES([tests/plugins/ctf/test_ctf_plugin], [chmod +x tests/plugins/ctf/test_ctf_plugin]) AC_CONFIG_FILES([tests/plugins/test_utils_muxer_complete], [chmod +x tests/plugins/test_utils_muxer_complete]) AC_CONFIG_FILES([tests/plugins/test_lttng_utils_debug_info], [chmod +x tests/plugins/test_lttng_utils_debug_info]) -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]) +AC_CONFIG_FILES([tests/plugins/test_dwarf_x86_64-linux-gnu], [chmod +x tests/plugins/test_dwarf_x86_64-linux-gnu]) +AC_CONFIG_FILES([tests/plugins/test_bin_info_x86_64-linux-gnu], [chmod +x tests/plugins/test_bin_info_x86_64-linux-gnu]) AS_IF([test "x$enable_python_bindings" = xyes], [ diff --git a/tests/Makefile.am b/tests/Makefile.am index 8d14cef0..e6cc4836 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,8 @@ SUBDIRS = utils cli lib bindings plugins -EXTRA_DIST = $(srcdir)/ctf-traces/** \ - $(srcdir)/debug-info-data/** \ - $(srcdir)/debug-info-data/.build-id/cd/** +# Directories added to EXTRA_DIST will be recursively copied to the distribution. +EXTRA_DIST = $(srcdir)/ctf-traces \ + $(srcdir)/debug-info-data TESTS_BINDINGS = @@ -53,8 +53,8 @@ endif if ENABLE_DEBUG_INFO TESTS_PLUGINS += \ - plugins/test_dwarf_complete \ - plugins/test_bin_info_complete + plugins/test_dwarf_x86_64-linux-gnu \ + plugins/test_bin_info_x86_64-linux-gnu endif TESTS_PYTHON_PLUGIN_PROVIDER = diff --git a/tests/debug-info-data/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/debug-info-data/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug deleted file mode 100644 index aaeed269..00000000 Binary files a/tests/debug-info-data/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug and /dev/null differ diff --git a/tests/debug-info-data/libhello_build_id_so b/tests/debug-info-data/libhello_build_id_so deleted file mode 100644 index a5055ee7..00000000 Binary files a/tests/debug-info-data/libhello_build_id_so and /dev/null differ diff --git a/tests/debug-info-data/libhello_debug_link_so b/tests/debug-info-data/libhello_debug_link_so deleted file mode 100644 index 340c828e..00000000 Binary files a/tests/debug-info-data/libhello_debug_link_so and /dev/null differ diff --git a/tests/debug-info-data/libhello_debug_link_so.debug b/tests/debug-info-data/libhello_debug_link_so.debug deleted file mode 100644 index f2743c38..00000000 Binary files a/tests/debug-info-data/libhello_debug_link_so.debug and /dev/null differ diff --git a/tests/debug-info-data/libhello_elf_so b/tests/debug-info-data/libhello_elf_so deleted file mode 100644 index 9d1eb29a..00000000 Binary files a/tests/debug-info-data/libhello_elf_so and /dev/null differ diff --git a/tests/debug-info-data/libhello_so b/tests/debug-info-data/libhello_so deleted file mode 100644 index 849f440a..00000000 Binary files a/tests/debug-info-data/libhello_so and /dev/null differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/debug-info-data/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug new file mode 100755 index 00000000..41e2cfb0 Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/build_id/libhello_so b/tests/debug-info-data/x86_64-linux-gnu/build_id/libhello_so new file mode 100755 index 00000000..0edfd79b Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/build_id/libhello_so differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so b/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so new file mode 100755 index 00000000..0c126010 Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so.debug b/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so.debug new file mode 100755 index 00000000..082f5136 Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/debug_link/libhello_so.debug differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/dwarf_full/libhello_so b/tests/debug-info-data/x86_64-linux-gnu/dwarf_full/libhello_so new file mode 100755 index 00000000..f8d3e411 Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/dwarf_full/libhello_so differ diff --git a/tests/debug-info-data/x86_64-linux-gnu/elf_only/libhello_so b/tests/debug-info-data/x86_64-linux-gnu/elf_only/libhello_so new file mode 100755 index 00000000..bffdaab7 Binary files /dev/null and b/tests/debug-info-data/x86_64-linux-gnu/elf_only/libhello_so differ diff --git a/tests/plugins/Makefile.am b/tests/plugins/Makefile.am index a4055ddd..ed129cbd 100644 --- a/tests/plugins/Makefile.am +++ b/tests/plugins/Makefile.am @@ -31,7 +31,6 @@ test_bin_info_LDADD = \ test_bin_info_SOURCES = test_bin_info.c noinst_PROGRAMS += test_dwarf test_bin_info -check_SCRIPTS += test_dwarf_complete test_bin_info_complete if !ENABLE_BUILT_IN_PLUGINS if ENABLE_PYTHON_BINDINGS diff --git a/tests/plugins/test_bin_info.c b/tests/plugins/test_bin_info.c index e2988017..5bf43da0 100644 --- a/tests/plugins/test_bin_info.c +++ b/tests/plugins/test_bin_info.c @@ -31,31 +31,34 @@ #define NR_TESTS 36 #define SO_NAME "libhello_so" -#define SO_NAME_ELF "libhello_elf_so" -#define SO_NAME_BUILD_ID "libhello_build_id_so" -#define SO_NAME_DEBUG_LINK "libhello_debug_link_so" + +#define DWARF_DIR_NAME "dwarf_full" +#define ELF_DIR_NAME "elf_only" +#define BUILDID_DIR_NAME "build_id" +#define DEBUGLINK_DIR_NAME "debug_link" + #define SO_LOW_ADDR 0x400000 #define SO_MEMSZ 0x400000 -#define FUNC_FOO_ADDR 0x4014ee -#define FUNC_FOO_LINE_NO 8 -#define FUNC_FOO_FILENAME "/efficios/libhello.c" -#define FUNC_FOO_TP_ADDR 0x4014d3 -#define FUNC_FOO_TP_LINE_NO 7 -#define FUNC_FOO_TP_FILENAME "/efficios/libhello.c" -#define FUNC_FOO_ADDR_ELF 0x4013ef -#define FUNC_FOO_ADDR_DBG_LINK 0x40148e -#define FUNC_FOO_NAME "foo+0xc3" -#define FUNC_FOO_NAME_ELF "foo+0x24" +#define FUNC_FOO_ADDR 0x402367 +#define FUNC_FOO_LINE_NO 36 +#define FUNC_FOO_FILENAME "./libhello.c" +#define FUNC_FOO_TP_ADDR 0x402300 +#define FUNC_FOO_TP_LINE_NO 35 +#define FUNC_FOO_TP_FILENAME "./libhello.c" +#define FUNC_FOO_ADDR_ELF 0x402367 +#define FUNC_FOO_ADDR_DBG_LINK 0x402367 +#define FUNC_FOO_NAME "foo+0xf0" +#define FUNC_FOO_NAME_ELF "foo+0xf0" #define BUILD_ID_LEN 20 char *opt_debug_info_dir; char *opt_debug_info_target_prefix; static -void test_bin_info_build_id(const char *data_dir) +void test_bin_info_build_id(const char *bin_info_dir) { int ret; - char path[PATH_MAX]; + char *data_dir, *bin_path; char *func_name = NULL; struct bin_info *bin = NULL; struct source_location *src_loc = NULL; @@ -67,11 +70,16 @@ void test_bin_info_build_id(const char *data_dir) diag("bin-info tests - separate DWARF via build ID"); - snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_BUILD_ID); + data_dir = g_build_filename(bin_info_dir, BUILDID_DIR_NAME, NULL); + bin_path = g_build_filename(bin_info_dir, BUILDID_DIR_NAME, SO_NAME, NULL); + + if (data_dir == NULL || bin_path == NULL) { + exit(EXIT_FAILURE); + } ret = bt_fd_cache_init(&fdc); BT_ASSERT(ret == 0); - bin = bin_info_create(&fdc, path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); + bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test setting build_id */ @@ -104,27 +112,34 @@ void test_bin_info_build_id(const char *data_dir) bin_info_destroy(bin); bt_fd_cache_fini(&fdc); + g_free(data_dir); + g_free(bin_path); } static -void test_bin_info_debug_link(const char *data_dir) +void test_bin_info_debug_link(const char *bin_info_dir) { int ret; - char path[PATH_MAX]; + char *data_dir, *bin_path; char *func_name = NULL; struct bin_info *bin = NULL; struct source_location *src_loc = NULL; - char *dbg_filename = "libhello_debug_link_so.debug"; - uint32_t crc = 0xe55c2b98; + char *dbg_filename = "libhello_so.debug"; + uint32_t crc = 0x289a8fdc; struct bt_fd_cache fdc; diag("bin-info tests - separate DWARF via debug link"); - snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_DEBUG_LINK); + data_dir = g_build_filename(bin_info_dir, DEBUGLINK_DIR_NAME, NULL); + bin_path = g_build_filename(bin_info_dir, DEBUGLINK_DIR_NAME, SO_NAME, NULL); + + if (data_dir == NULL || bin_path == NULL) { + exit(EXIT_FAILURE); + } ret = bt_fd_cache_init(&fdc); BT_ASSERT(ret == 0); - bin = bin_info_create(&fdc, path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, + bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); @@ -160,13 +175,15 @@ void test_bin_info_debug_link(const char *data_dir) bin_info_destroy(bin); bt_fd_cache_fini(&fdc); + g_free(data_dir); + g_free(bin_path); } static -void test_bin_info_elf(const char *data_dir) +void test_bin_info_elf(const char *bin_info_dir) { int ret; - char path[PATH_MAX]; + char *data_dir, *bin_path; char *func_name = NULL; struct bin_info *bin = NULL; struct source_location *src_loc = NULL; @@ -174,11 +191,16 @@ void test_bin_info_elf(const char *data_dir) diag("bin-info tests - ELF only"); - snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME_ELF); + data_dir = g_build_filename(bin_info_dir, ELF_DIR_NAME, NULL); + bin_path = g_build_filename(bin_info_dir, ELF_DIR_NAME, SO_NAME, NULL); + + if (data_dir == NULL || bin_path == NULL) { + exit(EXIT_FAILURE); + } ret = bt_fd_cache_init(&fdc); BT_ASSERT(ret == 0); - bin = bin_info_create(&fdc, path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); + bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test function name lookup (with ELF) */ @@ -205,13 +227,15 @@ void test_bin_info_elf(const char *data_dir) source_location_destroy(src_loc); bin_info_destroy(bin); bt_fd_cache_fini(&fdc); + g_free(data_dir); + g_free(bin_path); } static -void test_bin_info(const char *data_dir) +void test_bin_info(const char *bin_info_dir) { int ret; - char path[PATH_MAX]; + char *data_dir, *bin_path; char *func_name = NULL; struct bin_info *bin = NULL; struct source_location *src_loc = NULL; @@ -220,11 +244,16 @@ void test_bin_info(const char *data_dir) diag("bin-info tests - DWARF bundled with SO file"); - snprintf(path, PATH_MAX, "%s/%s", data_dir, SO_NAME); + data_dir = g_build_filename(bin_info_dir, DWARF_DIR_NAME, NULL); + bin_path = g_build_filename(bin_info_dir, DWARF_DIR_NAME, SO_NAME, NULL); + + if (data_dir == NULL || bin_path == NULL) { + exit(EXIT_FAILURE); + } ret = bt_fd_cache_init(&fdc); BT_ASSERT(ret == 0); - bin = bin_info_create(&fdc, path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); + bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); ok(bin != NULL, "bin_info_create successful"); /* Test bin_info_has_address */ @@ -292,6 +321,8 @@ void test_bin_info(const char *data_dir) bin_info_destroy(bin); bt_fd_cache_fini(&fdc); + g_free(data_dir); + g_free(bin_path); } int main(int argc, char **argv) diff --git a/tests/plugins/test_bin_info_complete.in b/tests/plugins/test_bin_info_complete.in deleted file mode 100644 index 434a0c35..00000000 --- a/tests/plugins/test_bin_info_complete.in +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2015 - Antoine Busque -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -NO_SH_TAP=1 -. "@abs_top_builddir@/tests/utils/common.sh" - -curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)" - -debug_info_data="${BT_SRC_PATH}/tests/debug-info-data" - -"${curdir}/test_bin_info" "$debug_info_data" diff --git a/tests/plugins/test_bin_info_x86_64-linux-gnu.in b/tests/plugins/test_bin_info_x86_64-linux-gnu.in new file mode 100644 index 00000000..461dfa48 --- /dev/null +++ b/tests/plugins/test_bin_info_x86_64-linux-gnu.in @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Copyright (C) 2015 - Antoine Busque +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; only version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +NO_SH_TAP=1 +. "@abs_top_builddir@/tests/utils/common.sh" + +curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)" + +debug_info_data="${BT_SRC_PATH}/tests/debug-info-data/x86_64-linux-gnu" + +"${curdir}/test_bin_info" "$debug_info_data" diff --git a/tests/plugins/test_dwarf.c b/tests/plugins/test_dwarf.c index 59a892dd..e4485846 100644 --- a/tests/plugins/test_dwarf.c +++ b/tests/plugins/test_dwarf.c @@ -30,17 +30,23 @@ #define NR_TESTS 15 +#define SO_NAME "libhello_so" +#define DWARF_DIR_NAME "dwarf_full" + static void test_bt_dwarf(const char *data_dir) { int fd, ret, tag; - char path[PATH_MAX]; + char *path; char *die_name = NULL; struct bt_dwarf_cu *cu = NULL; struct bt_dwarf_die *die = NULL; Dwarf *dwarf_info = NULL; - snprintf(path, PATH_MAX, "%s/libhello_so", data_dir); + path = g_build_filename(data_dir, DWARF_DIR_NAME, SO_NAME, NULL); + if (path == NULL) { + exit(EXIT_FAILURE); + } fd = open(path, O_RDONLY); ok(fd >= 0, "Open DWARF file %s", path); @@ -97,6 +103,7 @@ void test_bt_dwarf(const char *data_dir) dwarf_end(dwarf_info); free(die_name); close(fd); + g_free(path); } int main(int argc, char **argv) diff --git a/tests/plugins/test_dwarf_complete.in b/tests/plugins/test_dwarf_complete.in deleted file mode 100644 index 42bff22c..00000000 --- a/tests/plugins/test_dwarf_complete.in +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2015 - Antoine Busque -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -NO_SH_TAP=1 -. "@abs_top_builddir@/tests/utils/common.sh" - -curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)" - -debug_info_data="${BT_SRC_PATH}/tests/debug-info-data" - -"${curdir}/test_dwarf" "$debug_info_data" diff --git a/tests/plugins/test_dwarf_x86_64-linux-gnu.in b/tests/plugins/test_dwarf_x86_64-linux-gnu.in new file mode 100644 index 00000000..9d0c9d88 --- /dev/null +++ b/tests/plugins/test_dwarf_x86_64-linux-gnu.in @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Copyright (C) 2015 - Antoine Busque +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; only version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +NO_SH_TAP=1 +. "@abs_top_builddir@/tests/utils/common.sh" + +curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)" + +debug_info_data="${BT_SRC_PATH}/tests/debug-info-data/x86_64-linux-gnu" + +"${curdir}/test_dwarf" "$debug_info_data"