Travis: build matrix improvements + CPP11 build
authorLoic Blot <loic.blot@unix-experience.fr>
Wed, 5 Oct 2016 20:17:22 +0000 (22:17 +0200)
committerNer'zhul <nerzhul@users.noreply.github.com>
Wed, 5 Oct 2016 22:28:24 +0000 (00:28 +0200)
.travis.yml
src/unittest/test_settings.cpp
src/unittest/test_threading.cpp
util/travis/before_install.sh
util/travis/script.sh

index 9d16008188e68a06914bded42d962504cdf6a820..534479efb7aa8b3b3b9c6fde77449f1ce76d855e 100644 (file)
@@ -1,14 +1,4 @@
 language: cpp
-compiler:
-  - gcc
-  - clang
-os:
-  - osx
-  - linux
-env:
-  - PLATFORM=Win32
-  - PLATFORM=Win64
-  - PLATFORM=Unix
 before_install: ./util/travis/before_install.sh
 script: ./util/travis/script.sh
 sudo: required
@@ -16,14 +6,26 @@ notifications:
   email: false
 matrix:
   fast_finish: true
-  exclude:
+  include:
     - env: PLATFORM=Win32
-      compiler: clang
+      compiler: gcc
+      os: linux
     - env: PLATFORM=Win64
+      compiler: gcc
+      os: linux
+    - env: PLATFORM=Unix COMPILER=clang
       compiler: clang
-    - env: PLATFORM=Win32
-      os: osx
-    - env: PLATFORM=Win64
-      os: osx
-    - compiler: gcc
       os: osx
+    - env: PLATFORM=Unix COMPILER=g++
+      compiler: gcc
+      os: linux
+    - env: PLATFORM=Unix COMPILER=clang
+      compiler: clang
+      os: linux
+    - env: PLATFORM=Unix COMPILER=g++-6
+      compiler: gcc
+      os: linux
+addons:
+  apt:
+    sources: &sources
+      - ubuntu-toolchain-r-test
index a82d734f046f4cea615b318cb418f28ced8ee9f9..733c7e92a0589203d77de111536b0ae143e02f50 100644 (file)
@@ -32,7 +32,7 @@ public:
        void testAllSettings();
 
        static const char *config_text_before;
-       static const char *config_text_after;
+       static const std::string config_text_after;
 };
 
 static TestSettings g_test_instance;
@@ -69,7 +69,7 @@ const char *TestSettings::config_text_before =
        "np_terrain = 5, 40, (250, 250, 250), 12341, 5, 0.7, 2.4\n"
        "zoop = true";
 
-const char *TestSettings::config_text_after =
+const std::string TestSettings::config_text_after =
        "leet = 1337\n"
        "leetleet = 13371337\n"
        "leetleet_neg = -13371337\n"
@@ -197,7 +197,10 @@ void TestSettings::testAllSettings()
        UASSERT(s.updateConfigObject(is, os, "", 0) == true);
        //printf(">>>> expected config:\n%s\n", TEST_CONFIG_TEXT_AFTER);
        //printf(">>>> actual config:\n%s\n", os.str().c_str());
+#if __cplusplus < 201103L
+       // This test only works in older C++ versions than C++11 because we use unordered_map
        UASSERT(os.str() == config_text_after);
+#endif
        } catch (SettingNotFoundException &e) {
                UASSERT(!"Setting not found!");
        }
index 224e123dfecaf58f6b7794cc1ee981574c832eab..cdbf9674e39c1aee1b6ad02652df781a2a989c1e 100644 (file)
@@ -163,6 +163,7 @@ private:
 void TestThreading::testAtomicSemaphoreThread()
 {
        Atomic<u32> val;
+       val = 0;
        Semaphore trigger;
        static const u8 num_threads = 4;
 
index 70037389b4f41c74441bc60c2c2b76e80ba3feea..a2eb378030b91585289f8edcfa5ab7a15d66afeb 100755 (executable)
@@ -1,16 +1,8 @@
 #!/bin/bash -e
 
 if [[ $TRAVIS_OS_NAME == "linux" ]]; then
-       if [[ $CC == "clang" ]]; then
-               export PATH="/usr/bin/:$PATH"
-               sudo sh -c 'echo "deb http://ppa.launchpad.net/eudoxos/llvm-3.1/ubuntu precise main" >> /etc/apt/sources.list'
-               sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 92DE8183
-               sudo apt-get update
-               sudo apt-get install llvm-3.1
-               sudo apt-get install clang
-       fi
        sudo apt-get update
-       sudo apt-get install p7zip-full
+       sudo apt-get install p7zip-full $COMPILER
 fi
 
 if [[ $PLATFORM == "Unix" ]]; then
index 870954ebb57521e6f88bb7978274f88dea9349f3..4f37d8f5aec94c97c4f62ff58f195a53b290327f 100755 (executable)
@@ -4,6 +4,10 @@ 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'