about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--unittests/CMakeLists.txt12
-rw-r--r--unittests/TestMain.cpp13
2 files changed, 23 insertions, 2 deletions
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
index d21e6ad2..faf43a44 100644
--- a/unittests/CMakeLists.txt
+++ b/unittests/CMakeLists.txt
@@ -174,11 +174,21 @@ message(STATUS "GTEST_INCLUDE_DIR: ${GTEST_INCLUDE_DIR}")
 
 add_library(unittest_main)
 target_sources(unittest_main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/TestMain.cpp")
-target_link_libraries(unittest_main PUBLIC gtest)
+klee_get_llvm_libs(UNITTEST_MAIN_LIBS Support)
+target_link_libraries(unittest_main
+  PUBLIC
+  gtest
+
+  PRIVATE
+  ${UNITTEST_MAIN_LIBS}
+)
 target_include_directories(unittest_main
   PUBLIC
   ${GTEST_INCLUDE_DIR}
   ${KLEE_COMPONENT_EXTRA_INCLUDE_DIRS}
+
+  PRIVATE
+  ${LLVM_INCLUDE_DIRS}
 )
 target_compile_definitions(unittest_main PUBLIC ${KLEE_COMPONENT_CXX_DEFINES})
 target_compile_options(unittest_main PUBLIC ${KLEE_COMPONENT_CXX_FLAGS})
diff --git a/unittests/TestMain.cpp b/unittests/TestMain.cpp
index 4f43342f..42dd721a 100644
--- a/unittests/TestMain.cpp
+++ b/unittests/TestMain.cpp
@@ -7,10 +7,21 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "gtest/gtest.h"
+#include "klee/Config/Version.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Signals.h"
 
+#include "gtest/gtest.h"
 
 int main(int argc, char **argv) {
+
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0], true);
+#else
+  llvm::sys::PrintStackTraceOnErrorSignal(true);
+#endif
+
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }