diff options
author | Janek Bevendorff <janek@jbev.net> | 2017-03-14 16:53:29 +0300 |
---|---|---|
committer | Janek Bevendorff <janek@jbev.net> | 2017-03-15 17:23:52 +0300 |
commit | 2587bac30024f5e2c59a1c33bd25609e2466e000 (patch) | |
tree | 478df130b4705696d8104ba77cfad8ac6b109d44 | |
parent | 504bd402630ad0eacdd59b3f884e269c48c027c3 (diff) |
Enable ASAN option in Travis build
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/main.cpp | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index be05d6e47..e24d1d178 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,15 +13,15 @@ compiler: - gcc env: - - CONFIG=Release - - CONFIG=Debug + - CONFIG=Release ASAN_OPTIONS=detect_odr_violation=1:leak_check_at_exit=0 + - CONFIG=Debug ASAN_OPTIONS=detect_odr_violation=1:leak_check_at_exit=0 git: depth: 3 before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq update; fi - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq install cmake libmicrohttpd10 libmicrohttpd-dev libxi-dev qtbase5-dev libqt5x11extras5-dev qttools5-dev qttools5-dev-tools libgcrypt20-dev zlib1g-dev libxtst-dev xvfb libyubikey-dev libykpers-1-dev; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq install cmake libclang-common-3.5-dev libxi-dev qtbase5-dev libqt5x11extras5-dev qttools5-dev qttools5-dev-tools libgcrypt20-dev zlib1g-dev libxtst-dev xvfb libyubikey-dev libykpers-1-dev; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew ls | grep -wq cmake || brew install cmake; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew ls | grep -wq qt5 || brew install qt5; fi @@ -32,7 +32,7 @@ before_script: - mkdir build && pushd build script: - - cmake -DCMAKE_BUILD_TYPE=${CONFIG} -DWITH_GUI_TESTS=ON -DWITH_XC_HTTP=ON -DWITH_XC_AUTOTYPE=ON -DWITH_XC_YUBIKEY=ON $CMAKE_ARGS .. + - cmake -DCMAKE_BUILD_TYPE=${CONFIG} -DWITH_GUI_TESTS=ON -DWITH_ASAN=ON -DWITH_XC_HTTP=ON -DWITH_XC_AUTOTYPE=ON -DWITH_XC_YUBIKEY=ON $CMAKE_ARGS .. - make -j2 - if [ "$TRAVIS_OS_NAME" = "linux" ]; then make test ARGS+="-E testgui --output-on-failure"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then xvfb-run -a --server-args="-screen 0 800x600x24" make test ARGS+="-R testgui --output-on-failure"; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 86dedbc11..7b41ac2fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,10 @@ add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virt add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings") if(WITH_ASAN) add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN") + + if(NOT (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)) + add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN") + endif() endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) diff --git a/src/main.cpp b/src/main.cpp index 2563c843b..8ed4ee14c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ #include "gui/MainWindow.h" #include "gui/MessageBox.h" -#ifdef WITH_ASAN +#if defined(WITH_ASAN) && defined(WITH_LSAN) #include <sanitizer/lsan_interface.h> #endif @@ -137,7 +137,7 @@ int main(int argc, char** argv) int exitCode = app.exec(); -#ifdef WITH_ASAN +#if defined(WITH_ASAN) && defined(WITH_LSAN) // do leak check here to prevent massive tail of end-of-process leak errors from third-party libraries __lsan_do_leak_check(); __lsan_disable(); |