2 . util/travis/common.sh
4 needs_compile || exit 0
6 function perform_lint() {
7 CLANG_FORMAT=clang-format-3.9
8 if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
9 # Get list of every file modified in this pull request
10 files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)"
12 # Check everything for branch pushes
13 files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h' | egrep -v '^src/(gmp|lua|jsoncpp)/')"
17 for f in ${files_to_lint}; do
18 d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
19 if ! [ -z "$d" ]; then
20 printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d"
21 # Disable build failure at this moment as we need to have a complete MT source whitelist to check
26 if [ "$fail" = 1 ]; then
33 if [[ "$LINT" == "1" ]]; then
38 if [[ $PLATFORM == "Unix" ]]; then
40 cd travisbuild || exit 1
43 if [[ $COMPILER == "g++-6" ]]; then
48 # Clang builds with FreeType fail on Travis
49 if [[ $CC == "clang" ]]; then
50 CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE'
53 if [[ $TRAVIS_OS_NAME == "osx" ]]; then
54 CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext'
57 cmake -DCMAKE_BUILD_TYPE=Debug \
59 -DENABLE_GETTEXT=TRUE \
64 echo "Running unit tests."
65 CMD="../bin/minetest --run-unittests"
66 if [[ "$VALGRIND" == "1" ]]; then
67 valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
72 elif [[ $PLATFORM == Win* ]]; then
73 [[ $CC == "clang" ]] && exit 1 # Not supposed to happen
74 # We need to have our build directory outside of the minetest directory because
75 # CMake will otherwise get very very confused with symlinks and complain that
76 # something is not a subdirectory of something even if it actually is.
78 # /home/travis/minetest/minetest/travisbuild/minetest
80 # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest
82 # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
86 export EXISTING_MINETEST_DIR=$OLDDIR
87 export NO_MINETEST_GAME=1
88 if [[ $PLATFORM == "Win32" ]]; then
89 "$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0
90 elif [[ $PLATFORM == "Win64" ]]; then
91 "$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0
94 echo "Unknown platform \"${PLATFORM}\"."