From fbaefcfa0c1c6830cf766a9fb4f85e9a1f9e5c5e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 1 Aug 2023 21:42:02 +0200 Subject: [PATCH] Remove the test case. We cannot unwind on ARM (not supported by the platform), but only on x86 (32/64 bit) and also riscv4 Signed-off-by: DL6ER --- src/CMakeLists.txt | 2 +- src/signals.c | 2 ++ test/test_suite.bats | 11 ----------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b5dca255..419f9acf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -285,7 +285,7 @@ find_library(LIBGMP NAMES libgmp${CMAKE_STATIC_LIBRARY_SUFFIX} gmp) find_library(LIBNETTLE NAMES libnettle${CMAKE_STATIC_LIBRARY_SUFFIX} nettle HINTS /usr/local/lib64) find_library(LIBIDN NAMES libidn${CMAKE_STATIC_LIBRARY_SUFFIX} idn) find_library(LIBDL NAMES libdl${CMAKE_STATIC_LIBRARY_SUFFIX} dl) -target_link_libraries(pihole-FTL rt Threads::Threads ${LIBHOGWEED} ${LIBGMP} ${LIBNETTLE} ${LIBIDN} ${LIBDL}) +target_link_libraries(pihole-FTL rt Threads::Threads ${LIBHOGWEED} ${LIBGMP} ${LIBNETTLE} ${LIBIDN} -ldl ${LIBDL}) find_library(LIBUNWIND NAMES libunwind${CMAKE_STATIC_LIBRARY_SUFFIX} unwind) if(LIBUNWIND) diff --git a/src/signals.c b/src/signals.c index 25c27738..a672ca74 100644 --- a/src/signals.c +++ b/src/signals.c @@ -59,6 +59,7 @@ static char * __attribute__ ((nonnull (1))) getthread_name(char buffer[16]) return buffer; } +#if defined(USE_UNWIND) || defined(__GLIBC__) static void print_addr2line(const char *symbol, const void *addr) { // Only do this analysis for our own binary (skip trying to analyse libc.so, etc.) @@ -116,6 +117,7 @@ static int phdr_callback(struct dl_phdr_info *info, size_t size, void *data) } return 0; } +#endif void generate_backtrace(void) { #ifdef USE_UNWIND diff --git a/test/test_suite.bats b/test/test_suite.bats index c468cba3..1ec5bf90 100644 --- a/test/test_suite.bats +++ b/test/test_suite.bats @@ -1351,14 +1351,3 @@ [[ $status == 0 ]] run bash -c "rm ${filename}" } - -@test "Backtrace generation works for articifial crash test" { - run bash -c './pihole-FTL crash' - printf "%s\n" "${lines[@]}" - [[ "${lines[@]}" == *"--> FTL crashed! <--"* ]] - [[ "${lines[@]}" == *"1: ./pihole-FTL(signal_handler+"* ]] - [[ "${lines[@]}" == *"/app/src/signals.c:337"* ]] - [[ "${lines[@]}" == *"03: ./pihole-FTL(main+"* ]] - [[ "${lines[@]}" == *"/app/src/main.c:73"* ]] - [[ $status == 1 ]] -}