Skip to content

Commit

Permalink
CI: Add memleak checking using valgrind (#5350)
Browse files Browse the repository at this point in the history
Add a new step to check memleaks on our current unit tests suite
  • Loading branch information
nerzhul committed Mar 6, 2017
1 parent 0e27b4b commit 9878ce0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ matrix:
- env: PLATFORM=Unix COMPILER=clang
compiler: clang
os: linux
- env: PLATFORM=Unix COMPILER=clang VALGRIND=1
compiler: clang
os: linux
dist: trusty
- env: PLATFORM=Unix COMPILER=g++-6
compiler: gcc
os: linux
Expand Down
3 changes: 3 additions & 0 deletions util/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ if [[ $PLATFORM == "Unix" ]]; then
# Linking to LevelDB is broken, use a custom build
wget http://minetest.kitsunemimi.pw/libleveldb-1.18-ubuntu12.04.7z
sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z
if [[ "$VALGRIND" == "1" ]]; then
sudo apt-get install valgrind
fi
else
brew update
brew install freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit
Expand Down
9 changes: 8 additions & 1 deletion util/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ if [[ $PLATFORM == "Unix" ]]; then
-DBUILD_SERVER=TRUE \
$CMAKE_FLAGS ..
make -j2

echo "Running unit tests."
../bin/minetest --run-unittests && exit 0
CMD="../bin/minetest --run-unittests"
if [[ "$VALGRIND" == "1" ]]; then
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
else
${CMD} && exit 0
fi

elif [[ $PLATFORM == Win* ]]; then
[[ $CC == "clang" ]] && exit 1 # Not supposed to happen
# We need to have our build directory outside of the minetest directory because
Expand Down

0 comments on commit 9878ce0

Please sign in to comment.