← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/stricter_travis into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/stricter_travis into lp:widelands.

Commit message:
- Change warnings around switches: GCC no longer complains if a switch has no default, clang complains if a switch that covers all cases has a default. 
- Run regression test on travis after each build. Regression test now also output full stdout on error.
- Make codecheck warnings critical errors for debug builds on travis.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/stricter_travis/+merge/282852

Make CI more usefull.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/stricter_travis into lp:widelands.
=== modified file '.travis.sh'
--- .travis.sh	2016-01-11 20:27:54 +0000
+++ .travis.sh	2016-01-16 18:04:12 +0000
@@ -2,7 +2,7 @@
 
 # Some of these commands fail transiently. We keep retrying them until they
 # succeed.
-if [ "$CXX" = "g++" ]; then 
+if [ "$CXX" = "g++" ]; then
    until sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; do sleep 10; done
 fi
 if [ "$CXX" = "clang++" ]; then
@@ -12,7 +12,7 @@
 until sudo add-apt-repository ppa:zoogie/sdl2-snapshots -y; do sleep 10; done
 until sudo apt-get update -qq; do sleep 10; done
 
-if [ "$CXX" = "g++" ]; then 
+if [ "$CXX" = "g++" ]; then
    sudo apt-get install -qq g++-$GCC_VERSION;
    export CXX="g++-$GCC_VERSION" CC="gcc-$GCC_VERSION";
 fi
@@ -37,8 +37,24 @@
    libsdl2-ttf-dev \
 ; do sleep 10; done
 
-# Start the actual build. 
+# Configure the build
 mkdir build
 cd build
 cmake .. -DCMAKE_BUILD_TYPE:STRING="$BUILD_TYPE"
+
+# Any codecheck warning is an error in Debug builds. Keep the codebase clean!!
+if [ "$BUILD_TYPE" == "Debug" ]; then
+   # Suppress color output.
+   TERM=dumb make -j1 codecheck 2>&1 | tee codecheck.out
+   if grep '^[/_.a-zA-Z]\+:[0-9]\+:' codecheck.out; then 
+      echo "You have codecheck warnings (see above) Please fix."
+      exit 1 # CodeCheck warnings.
+   fi
+fi
+
+# Do the actual build.
 make -k -j1
+
+# Run the regression suite.
+cd ..
+./regression_test.py -b build/src/widelands

=== modified file '.travis.yml'
--- .travis.yml	2016-01-10 19:00:06 +0000
+++ .travis.yml	2016-01-16 18:04:12 +0000
@@ -3,6 +3,11 @@
 sudo: required
 dist: trusty
 
+before_script:
+  - "export DISPLAY=:99.0"
+  - "sh -e /etc/init.d/xvfb start"
+  - sleep 3 # give xvfb some time to start
+
 matrix:
   include:
      - compiler: clang

=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2016-01-11 20:25:48 +0000
+++ CMakeLists.txt	2016-01-16 18:04:12 +0000
@@ -105,19 +105,11 @@
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-global-constructors")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
-  wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-switch-enum")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-implicit-fallthrough")
 
   # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
-
-  # This warning warns when a default case is at a switch that handles all
-  # cases. While this is super nice, silencing this warning for clang will add
-  # a warning for GCC (which is not as clever and does not figure out that all
-  # cases are handled). Therefore we disable the warning and the unreachable as
-  # they always come in pairs in these cases.
-  wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-covered-switch-default")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unreachable-code")
 
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Werror=non-pod-varargs")
@@ -158,7 +150,6 @@
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpointer-arith")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsign-promo")
-  wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wswitch-default")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines")
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wundef")

=== modified file 'regression_test.py'
--- regression_test.py	2014-06-22 12:02:10 +0000
+++ regression_test.py	2016-01-16 18:04:12 +0000
@@ -116,8 +116,8 @@
             self.verify_success(stdout, stdout_filename)
 
     def verify_success(self, stdout, stdout_filename):
-        common_msg = "Analyze the files in %s to see why this test case failed. Stdout is\n  %s\n" % (
-                self.run_dir, stdout_filename)
+        common_msg = "Analyze the files in %s to see why this test case failed. Stdout is\n  %s\n\nstdout:\n%s" % (
+                self.run_dir, stdout_filename, stdout)
         self.assertTrue(self.widelands_returncode == 0,
             "Widelands exited abnormally. %s" % common_msg
         )


References