Skip to content

Commit 9878ce0

Browse files
authoredMar 6, 2017
CI: Add memleak checking using valgrind (#5350)
Add a new step to check memleaks on our current unit tests suite
1 parent 0e27b4b commit 9878ce0

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed
 

‎.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ matrix:
2222
- env: PLATFORM=Unix COMPILER=clang
2323
compiler: clang
2424
os: linux
25+
- env: PLATFORM=Unix COMPILER=clang VALGRIND=1
26+
compiler: clang
27+
os: linux
28+
dist: trusty
2529
- env: PLATFORM=Unix COMPILER=g++-6
2630
compiler: gcc
2731
os: linux

‎util/travis/before_install.sh

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ if [[ $PLATFORM == "Unix" ]]; then
1818
# Linking to LevelDB is broken, use a custom build
1919
wget http://minetest.kitsunemimi.pw/libleveldb-1.18-ubuntu12.04.7z
2020
sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z
21+
if [[ "$VALGRIND" == "1" ]]; then
22+
sudo apt-get install valgrind
23+
fi
2124
else
2225
brew update
2326
brew install freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit

‎util/travis/script.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ if [[ $PLATFORM == "Unix" ]]; then
2424
-DBUILD_SERVER=TRUE \
2525
$CMAKE_FLAGS ..
2626
make -j2
27+
2728
echo "Running unit tests."
28-
../bin/minetest --run-unittests && exit 0
29+
CMD="../bin/minetest --run-unittests"
30+
if [[ "$VALGRIND" == "1" ]]; then
31+
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
32+
else
33+
${CMD} && exit 0
34+
fi
35+
2936
elif [[ $PLATFORM == Win* ]]; then
3037
[[ $CC == "clang" ]] && exit 1 # Not supposed to happen
3138
# We need to have our build directory outside of the minetest directory because

0 commit comments

Comments
 (0)