Skip to content

Commit

Permalink
Conditional test building + execinfo feature check (#324)
Browse files Browse the repository at this point in the history
* Check cmake test building option
* Conditional stack traces
  • Loading branch information
bretambrose authored Apr 29, 2019
1 parent c2628e8 commit a972c5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ configure_file(${CONFIG_HEADER_TEMPLATE}

if (NOT CMAKE_CROSSCOMPILING)
include(CTest)
add_subdirectory(tests)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()

include(CPackConfig)
5 changes: 5 additions & 0 deletions cmake/AwsFeatureTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ int main() {
__asm__ __volatile__(\"\":\"=r\"(foo):\"r\"(bar):\"memory\");
}" AWS_HAVE_GCC_INLINE_ASM)

check_c_source_compiles("
#include <execinfo.h>
int main() {
return 0;
}" AWS_HAS_EXECINFO)
4 changes: 2 additions & 2 deletions include/aws/testing/aws_test_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ static LONG WINAPI s_test_print_stack_trace(struct _EXCEPTION_POINTERS *exceptio
}
return EXCEPTION_EXECUTE_HANDLER;
}
#elif !defined __ANDROID__
#elif AWS_HAS_EXECINFO
# include <execinfo.h>
# include <signal.h>

Expand Down Expand Up @@ -474,7 +474,7 @@ static inline int s_aws_run_test_case(struct aws_test_harness *harness) {

#ifdef _WIN32
SetUnhandledExceptionFilter(s_test_print_stack_trace);
#elif !defined __ANDROID__
#elif AWS_HAS_EXECINFO
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
sigemptyset(&sa.sa_mask);
Expand Down

0 comments on commit a972c5c

Please sign in to comment.