From a1a328b04aaf2e0d1b211bbd939c2d11a1d8643e Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 4 May 2016 14:36:19 -0400 Subject: [PATCH] Don't use the .so extension on test assets MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some packaging systems, such as dpkg-source in native mode used by Debian's daily build system, will filter out files considered unclean prior to the build. This behavior causes our test assets to be deleted which, subsequently, fails the make check. Since we do not require the .so extension and these files should be treated as blobs, we rename them to "_so". Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- tests/debuginfo-data/README.md | 32 ++++++++++-------- ...hello_build_id.so => libhello_build_id_so} | Bin ...o_debug_link.so => libhello_debug_link_so} | Bin ....so.debug => libhello_debug_link_so.debug} | Bin .../{libhello_elf.so => libhello_elf_so} | Bin .../{libhello.so => libhello_so} | Bin tests/lib/test_bin_info.c | 10 +++--- tests/lib/test_dwarf.c | 2 +- 8 files changed, 24 insertions(+), 20 deletions(-) rename tests/debuginfo-data/{libhello_build_id.so => libhello_build_id_so} (100%) rename tests/debuginfo-data/{libhello_debug_link.so => libhello_debug_link_so} (100%) rename tests/debuginfo-data/{libhello_debug_link.so.debug => libhello_debug_link_so.debug} (100%) rename tests/debuginfo-data/{libhello_elf.so => libhello_elf_so} (100%) rename tests/debuginfo-data/{libhello.so => libhello_so} (100%) diff --git a/tests/debuginfo-data/README.md b/tests/debuginfo-data/README.md index 88e77311..db131bc4 100644 --- a/tests/debuginfo-data/README.md +++ b/tests/debuginfo-data/README.md @@ -8,13 +8,17 @@ files used to generate them. The generated files are: -* `libhello.so` (ELF and DWARF) -* `libhello_elf.so` (ELF only) -* `libhello_build_id.so` (ELF with separate DWARF via build ID) -* `libhello_debug_link.so` (ELF with separate DWARF via debug link) -* `libhello_debug_link.so.debug` (DWARF for debug link) +* `libhello_so` (ELF and DWARF) +* `libhello_elf_so` (ELF only) +* `libhello_build_id_so` (ELF with separate DWARF via build ID) +* `libhello_debug_link_so` (ELF with separate DWARF via debug link) +* `libhello_debug_link_so.debug` (DWARF for debug link) * `.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug` (DWARF for build ID) +We use a suffix of "_so" instead of ".so" since some distributions +build systems will consider ".so" files as artifacts from a previous +build that were "left-over" and will remove them prior to the build. + All files are generated from the four (4) following source files: * libhello.c @@ -30,20 +34,20 @@ To regenerate them, you can use follow these steps: ## ELF and DWARF $ gcc -g -fPIC -c -I. tp.c libhello.c - $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello.so -o libhello.so tp.o libhello.o + $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello.so -o libhello_so tp.o libhello.o ## ELF only $ gcc -fPIC -c -I. tp.c libhello.c - $ gcc -shared -llttng-ust -ldl -Wl,-soname,libhello_elf.so -o libhello_elf.so tp.o libhello.o + $ gcc -shared -llttng-ust -ldl -Wl,-soname,libhello_elf.so -o libhello_elf_so tp.o libhello.o ## ELF and DWARF with Build ID $ gcc -g -fPIC -c -I. tp.c libhello.c - $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_build_id.so -Wl,--build-id=sha1 -o libhello_build_id.so tp.o libhello.o + $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_build_id.so -Wl,--build-id=sha1 -o libhello_build_id_so tp.o libhello.o $ mkdir -p .build-id/cd/ - $ objcopy --only-keep-debug libhello_build_id.so .build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug - $ strip -g libhello_build_id.so + $ objcopy --only-keep-debug libhello_build_id_so .build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug + $ strip -g libhello_build_id_so The build ID might not be the same once the executable is regenerated on your system, so adjust the values in the directory and file names @@ -53,8 +57,8 @@ https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html ## ELF and DWARF with Debug Link $ gcc -g -fPIC -c -I. tp.c libhello.c - $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_debug_link.so -o libhello_debug_link.so tp.o libhello.o + $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello_debug_link.so -o libhello_debug_link_so tp.o libhello.o - $ objcopy --only-keep-debug libhello_debug_link.so libhello_debug_link.so.debug - $ strip -g libhello_debug_link.so - $ objcopy --add-gnu-debuglink=libhello_debug_link.so.debug libhello_debug_link.so + $ objcopy --only-keep-debug libhello_debug_link_so libhello_debug_link_so.debug + $ strip -g libhello_debug_link_so + $ objcopy --add-gnu-debuglink=libhello_debug_link_so.debug libhello_debug_link_so diff --git a/tests/debuginfo-data/libhello_build_id.so b/tests/debuginfo-data/libhello_build_id_so similarity index 100% rename from tests/debuginfo-data/libhello_build_id.so rename to tests/debuginfo-data/libhello_build_id_so diff --git a/tests/debuginfo-data/libhello_debug_link.so b/tests/debuginfo-data/libhello_debug_link_so similarity index 100% rename from tests/debuginfo-data/libhello_debug_link.so rename to tests/debuginfo-data/libhello_debug_link_so diff --git a/tests/debuginfo-data/libhello_debug_link.so.debug b/tests/debuginfo-data/libhello_debug_link_so.debug similarity index 100% rename from tests/debuginfo-data/libhello_debug_link.so.debug rename to tests/debuginfo-data/libhello_debug_link_so.debug diff --git a/tests/debuginfo-data/libhello_elf.so b/tests/debuginfo-data/libhello_elf_so similarity index 100% rename from tests/debuginfo-data/libhello_elf.so rename to tests/debuginfo-data/libhello_elf_so diff --git a/tests/debuginfo-data/libhello.so b/tests/debuginfo-data/libhello_so similarity index 100% rename from tests/debuginfo-data/libhello.so rename to tests/debuginfo-data/libhello_so diff --git a/tests/lib/test_bin_info.c b/tests/lib/test_bin_info.c index 0a7da604..fd9e4f1c 100644 --- a/tests/lib/test_bin_info.c +++ b/tests/lib/test_bin_info.c @@ -27,10 +27,10 @@ #include "tap/tap.h" #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 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 SO_LOW_ADDR 0x400000 #define SO_MEMSZ 0x400000 #define FUNC_FOO_ADDR 0x4014ee @@ -107,7 +107,7 @@ void test_bin_info_debug_link(const char *data_dir) char *func_name = NULL; struct bin_info *bin = NULL; struct source_location *src_loc = NULL; - char *dbg_filename = "libhello_debug_link.so.debug"; + char *dbg_filename = "libhello_debug_link_so.debug"; uint32_t crc = 0xe55c2b98; diag("bin-info tests - separate DWARF via debug link"); diff --git a/tests/lib/test_dwarf.c b/tests/lib/test_dwarf.c index cee2d446..61b102eb 100644 --- a/tests/lib/test_dwarf.c +++ b/tests/lib/test_dwarf.c @@ -40,7 +40,7 @@ void test_bt_dwarf(const char *data_dir) struct bt_dwarf_die *die = NULL; Dwarf *dwarf_info = NULL; - snprintf(path, PATH_MAX, "%s/libhello.so", data_dir); + snprintf(path, PATH_MAX, "%s/libhello_so", data_dir); fd = open(path, O_RDONLY); ok(fd >= 0, "Open DWARF file %s", path); -- 2.34.1