Skip to content

Commit

Permalink
[travis] Enable valgrind memory check (#2)
Browse files Browse the repository at this point in the history
* [travis] add valgrind

* fix typo
  • Loading branch information
zouzias authored Jul 3, 2019
1 parent 49ce78d commit cba91f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language: cpp
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -q
- sudo apt-get install -q gcc g++ cmake libeigen3-dev git wget python-dev
- sudo apt-get install -q gcc g++ cmake libeigen3-dev git wget python-dev valgrind
- pip install --user cpp-coveralls
- git submodule add -f https://github.com/pybind/pybind11.git # add pybind11 submodule
- git submodule update --init --recursive
Expand All @@ -16,6 +16,8 @@ script:
- cmake ..
- cmake --build .
- ctest
- ctest -T memcheck
- valgrind --leak-check=full --track-fds=yes --error-exitcode=1 ./bin/unit_tests

after_success:
- coveralls --root .. -E ".*pybind11.*" -E ".*external.*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*"
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ endif()

add_subdirectory(src)


# ------------------------------------------------------------------------------
# Valgrind
# ------------------------------------------------------------------------------
include (CTest)
set(MemoryCheckCommand /usr/bin/valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS "${MEMORYCHECK_COMMAND_OPTIONS} --leak-check=full")
set(MEMORYCHECK_COMMAND_OPTIONS "${MEMORYCHECK_COMMAND_OPTIONS} --track-fds=yes")
set(MEMORYCHECK_COMMAND_OPTIONS "${MEMORYCHECK_COMMAND_OPTIONS} --trace-children=yes")
set(MEMORYCHECK_COMMAND_OPTIONS "${MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=1")

include(cmake/googletest.cmake)
fetch_googletest(
${PROJECT_SOURCE_DIR}/cmake
Expand Down
2 changes: 1 addition & 1 deletion runBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Clone pybind11 repository as GIT submodule
if [[ ! -d pybind11 ]]; then
git submodule add ttps://github.com/pybind/pybind11.git
git submodule add https://github.com/pybind/pybind11.git
git submodule update --init --recursive
fi

Expand Down

0 comments on commit cba91f6

Please sign in to comment.