From 9285aa59c1b3b629fa8f70f5ded056ae5b5798e4 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Thu, 26 Jan 2017 10:12:11 -0800 Subject: [PATCH] Set -DNDEBUG for travis debug builds. Within the sysdig code there are several ASSERTS() that can occur for error paths that aren't truly critical, such as: 17:33:52 DEBUG| [stderr] falco: /home/travis/build/draios/sysdig/userspace/libsinsp/parsers.cpp:1657: static void sinsp_parser::parse_openat_dir(sinsp_evt*, char*, int64_t, std::string*): Assertion `false' failed. Looking at the code, it's not a truly fatal error, just an inability to find fd information: ---- if(evt->m_fdinfo == NULL) { ASSERT(false); *sdir = ""; } ---- When running regression tests in travis, we don't want these ASSERTs to cause falco to exit. To allow this, in CMakeLists.txt only set DRAIOS_DEBUG_FLAGS if it wasn't already set, and in travis's cmake, add -DNDEBUG to DRAIOS_DEBUG_FLAGS. --- .travis.yml | 2 +- CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0678351..7655a564 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ script: - cd .. - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DDRAIOS_DEBUG_FLAGS="-D_DEBUG -DNDEBUG" - make VERBOSE=1 - make package - cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d54005c..b9fc30fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,9 @@ if(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) endif() -set(DRAIOS_DEBUG_FLAGS "-D_DEBUG") +if(NOT DRAIOS_DEBUG_FLAGS) + set(DRAIOS_DEBUG_FLAGS "-D_DEBUG") +endif() set(CMAKE_C_FLAGS "-Wall -ggdb ${DRAIOS_FEATURE_FLAGS}") set(CMAKE_CXX_FLAGS "-Wall -ggdb --std=c++0x ${DRAIOS_FEATURE_FLAGS}")