From 8aadc62856cc3789ed345ddf3870e311af60afe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Wed, 4 Jan 2017 14:36:51 +0100 Subject: Travis: Build server too for UNIX --- util/travis/script.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 1bafb26cd..24a74d186 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -21,6 +21,7 @@ if [[ $PLATFORM == "Unix" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DRUN_IN_PLACE=TRUE \ -DENABLE_GETTEXT=TRUE \ + -DBUILD_SERVER=TRUE \ $CMAKE_FLAGS .. make -j2 echo "Running unit tests." -- cgit v1.2.3 From 9878ce05e75421820115b8eaaf3752ab4bd06e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Mon, 6 Mar 2017 20:34:02 +0100 Subject: CI: Add memleak checking using valgrind (#5350) Add a new step to check memleaks on our current unit tests suite --- util/travis/script.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'util/travis/script.sh') 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 -- cgit v1.2.3 From 22567d107fffe7a6833b96cc99d531e5303b47dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 25 Mar 2017 19:12:18 +0100 Subject: Add clang format & skip build if no source file modified (#5433) * [BUILD] Add clang format + build skipping * Add clang-format tool to check codestyle. Warning: it check the whole modified file, not the diff part, it's why it's lazy. Please also look if rules are perfect, i take the Linux codestyle from LLVM site Fix issue #5415 * Skip building project if no file is modified * Fix a wrong brace to trigger LINT * Make lint step outside of unix build scope * Add AccessModifierOffset: -8 * Typo fix & needs compile fix * Fix header priorities --- util/travis/script.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 84ea578a5..557822e1f 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -3,21 +3,57 @@ needs_compile || exit 0 +function perform_lint() { + CLANG_FORMAT=clang-format-3.9 + if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then + # Get list of every file modified in this pull request + files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)" + else + # Check everything for branch pushes + files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h' | egrep -v '^src/(gmp|lua|jsoncpp)/')" + fi + + local fail=0 + for f in ${files_to_lint}; do + d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) + if ! [ -z "$d" ]; then + printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d" + # Disable build failure at this moment as we need to have a complete MT source whitelist to check + fail=0 + fi + done + + if [ "$fail" = 1 ]; then + exit 1 + fi + + exit 0 +} + +if [[ "$LINT" == "1" ]]; then + # Lint with exit CI + perform_lint +fi + if [[ $PLATFORM == "Unix" ]]; then mkdir -p travisbuild cd travisbuild || exit 1 + CMAKE_FLAGS='' if [[ $COMPILER == "g++-6" ]]; then export CC=gcc-6 export CXX=g++-6 fi + # Clang builds with FreeType fail on Travis if [[ $CC == "clang" ]]; then CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE' fi + if [[ $TRAVIS_OS_NAME == "osx" ]]; then CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext' fi + cmake -DCMAKE_BUILD_TYPE=Debug \ -DRUN_IN_PLACE=TRUE \ -DENABLE_GETTEXT=TRUE \ -- cgit v1.2.3 From aa5549ecc33606f786c8cef433e0dbe9188f3ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 26 Mar 2017 11:29:21 +0200 Subject: clang-format: limit diff to 50 files to prevent exceding the maximum travis output (4MB) (#5455) --- util/travis/script.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 557822e1f..ab524b4b4 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -13,11 +13,18 @@ function perform_lint() { files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h' | egrep -v '^src/(gmp|lua|jsoncpp)/')" fi + local errorcount=0 local fail=0 for f in ${files_to_lint}; do d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) if ! [ -z "$d" ]; then + ((errorcount++)) printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d" + if [ ${errorcount} -gt 50 ]; then + printf "Too many errors encountered previously, this diff is hidden.\n" + else + printf "%s\n" "$d" + fi # Disable build failure at this moment as we need to have a complete MT source whitelist to check fail=0 fi -- cgit v1.2.3 From 72ce9d7a5d51f6308390748693e518632c1795e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 26 Mar 2017 14:07:07 +0200 Subject: clang-format: fix counter increment & output (#5456) clang-format: fix bash syntax on increment --- util/travis/script.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index ab524b4b4..0e4f92eef 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -4,6 +4,7 @@ needs_compile || exit 0 function perform_lint() { + echo "Performing LINT..." CLANG_FORMAT=clang-format-3.9 if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then # Get list of every file modified in this pull request @@ -17,13 +18,15 @@ function perform_lint() { local fail=0 for f in ${files_to_lint}; do d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) + if ! [ -z "$d" ]; then - ((errorcount++)) - printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d" + errorcount=$((errorcount+1)) + + printf "The file %s is not compliant with the coding style" "$f" if [ ${errorcount} -gt 50 ]; then - printf "Too many errors encountered previously, this diff is hidden.\n" + printf "\nToo many errors encountered previously, this diff is hidden.\n" else - printf "%s\n" "$d" + printf ":\n%s\n" "$d" fi # Disable build failure at this moment as we need to have a complete MT source whitelist to check fail=0 @@ -31,15 +34,15 @@ function perform_lint() { done if [ "$fail" = 1 ]; then + echo "LINT reports failure." exit 1 fi - - exit 0 } if [[ "$LINT" == "1" ]]; then # Lint with exit CI perform_lint + exit 0 fi if [[ $PLATFORM == "Unix" ]]; then -- cgit v1.2.3 From 4b05feaceb38a2ab2063b8ff6e92d96393ad384e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Mon, 27 Mar 2017 15:33:15 +0200 Subject: clang-format: add a whitelist (#5459) If file is in the whitelist, softfail, else hard failure Some files are not in whitelist and marked as normal: * src/content_mapnode.h * src/cguittfont/xCGUITTFont.cpp * src/gameparams.h * src/profiler.cpp --- util/travis/script.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 0e4f92eef..ef42916b0 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -6,6 +6,8 @@ needs_compile || exit 0 function perform_lint() { echo "Performing LINT..." CLANG_FORMAT=clang-format-3.9 + CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt" + if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then # Get list of every file modified in this pull request files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)" @@ -28,8 +30,13 @@ function perform_lint() { else printf ":\n%s\n" "$d" fi - # Disable build failure at this moment as we need to have a complete MT source whitelist to check - fail=0 + + whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}") + + # If file is not whitelisted, mark a failure + if [ ${whitelisted} -eq 0 ]; then + fail=1 + fi fi done @@ -37,6 +44,8 @@ function perform_lint() { echo "LINT reports failure." exit 1 fi + + echo "LINT OK" } if [[ "$LINT" == "1" ]]; then -- cgit v1.2.3 From 86b1542181a92841d174e1caec94d084a34e5158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 2 Apr 2017 10:51:50 +0200 Subject: Update embedded jsoncpp from unk version to 0.10.6 + move libs to lib/ instead of src/ (#5473) * Update embedded jsoncpp from unk version to 0.10.6 0.10.6 is last release without c++11 * Make jsoncpp more compliant with its amalgamate Jsoncpp cpp file should be upper, make the library like it does in amalgamate * Reorganization: move minetest embedded libs outside of source tree to /lib * Fix a dead grep in LINT --- util/travis/script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index ef42916b0..4a12df5f6 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -10,10 +10,10 @@ function perform_lint() { if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then # Get list of every file modified in this pull request - files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)" + files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | true)" else # Check everything for branch pushes - files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h' | egrep -v '^src/(gmp|lua|jsoncpp)/')" + files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" fi local errorcount=0 -- cgit v1.2.3 From 503e1d2b7c800a76a161541d90b799e9786adbd9 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 6 Apr 2017 08:42:52 +0200 Subject: Clang format: only show errors on non whitelisted files --- util/travis/script.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 4a12df5f6..44057352d 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -22,19 +22,19 @@ function perform_lint() { d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) if ! [ -z "$d" ]; then - errorcount=$((errorcount+1)) - - printf "The file %s is not compliant with the coding style" "$f" - if [ ${errorcount} -gt 50 ]; then - printf "\nToo many errors encountered previously, this diff is hidden.\n" - else - printf ":\n%s\n" "$d" - fi - whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}") # If file is not whitelisted, mark a failure if [ ${whitelisted} -eq 0 ]; then + errorcount=$((errorcount+1)) + + printf "The file %s is not compliant with the coding style" "$f" + if [ ${errorcount} -gt 50 ]; then + printf "\nToo many errors encountered previously, this diff is hidden.\n" + else + printf ":\n%s\n" "$d" + fi + fail=1 fi fi -- cgit v1.2.3 From 4b15f76ed163b1e0b95b50017bd39e73400601b4 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 6 Apr 2017 09:10:59 +0200 Subject: Move LINT process in dedicated shell & fix Move lint to dedicated shell permit to use it from your shell easily to check what is wrong Also fix recent regressions in code style --- util/travis/script.sh | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 44057352d..14b8dfb73 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -1,53 +1,9 @@ #!/bin/bash -e . util/travis/common.sh +. util/travis/lint.sh needs_compile || exit 0 -function perform_lint() { - echo "Performing LINT..." - CLANG_FORMAT=clang-format-3.9 - CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt" - - if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then - # Get list of every file modified in this pull request - files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | true)" - else - # Check everything for branch pushes - files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" - fi - - local errorcount=0 - local fail=0 - for f in ${files_to_lint}; do - d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) - - if ! [ -z "$d" ]; then - whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}") - - # If file is not whitelisted, mark a failure - if [ ${whitelisted} -eq 0 ]; then - errorcount=$((errorcount+1)) - - printf "The file %s is not compliant with the coding style" "$f" - if [ ${errorcount} -gt 50 ]; then - printf "\nToo many errors encountered previously, this diff is hidden.\n" - else - printf ":\n%s\n" "$d" - fi - - fail=1 - fi - fi - done - - if [ "$fail" = 1 ]; then - echo "LINT reports failure." - exit 1 - fi - - echo "LINT OK" -} - if [[ "$LINT" == "1" ]]; then # Lint with exit CI perform_lint -- cgit v1.2.3