aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-03-06 20:34:02 +0100
committerGitHub <noreply@github.com>2017-03-06 20:34:02 +0100
commit9878ce05e75421820115b8eaaf3752ab4bd06e57 (patch)
treed1e4ba51f082a1c04e230eefc374ba10104575ad
parent0e27b4b978d81504a9e3bf221e6e4691c720e6ef (diff)
downloadminetest-9878ce05e75421820115b8eaaf3752ab4bd06e57.tar.gz
minetest-9878ce05e75421820115b8eaaf3752ab4bd06e57.tar.bz2
minetest-9878ce05e75421820115b8eaaf3752ab4bd06e57.zip
CI: Add memleak checking using valgrind (#5350)
Add a new step to check memleaks on our current unit tests suite
-rw-r--r--.travis.yml4
-rwxr-xr-xutil/travis/before_install.sh3
-rwxr-xr-xutil/travis/script.sh9
3 files changed, 15 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index 534479efb..3274aedaf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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
diff --git a/util/travis/before_install.sh b/util/travis/before_install.sh
index 891371984..ea85b3db6 100755
--- a/util/travis/before_install.sh
+++ b/util/travis/before_install.sh
@@ -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
diff --git a/util/travis/script.sh b/util/travis/script.sh
index 24a74d186..84ea578a5 100755
--- a/util/travis/script.sh
+++ b/util/travis/script.sh
@@ -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