Skip to content

Commit 61d1751

Browse files
committedOct 5, 2016
Travis: build matrix improvements + CPP11 build
1 parent 7fab86a commit 61d1751

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed
 

Diff for: ‎.travis.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
language: cpp
2-
compiler:
3-
- gcc
4-
- clang
5-
os:
6-
- osx
7-
- linux
8-
env:
9-
- PLATFORM=Win32
10-
- PLATFORM=Win64
11-
- PLATFORM=Unix
122
before_install: ./util/travis/before_install.sh
133
script: ./util/travis/script.sh
144
sudo: required
155
notifications:
166
email: false
177
matrix:
188
fast_finish: true
19-
exclude:
9+
include:
2010
- env: PLATFORM=Win32
21-
compiler: clang
11+
compiler: gcc
12+
os: linux
2213
- env: PLATFORM=Win64
14+
compiler: gcc
15+
os: linux
16+
- env: PLATFORM=Unix COMPILER=clang
2317
compiler: clang
24-
- env: PLATFORM=Win32
25-
os: osx
26-
- env: PLATFORM=Win64
27-
os: osx
28-
- compiler: gcc
2918
os: osx
19+
- env: PLATFORM=Unix COMPILER=g++
20+
compiler: gcc
21+
os: linux
22+
- env: PLATFORM=Unix COMPILER=clang
23+
compiler: clang
24+
os: linux
25+
- env: PLATFORM=Unix COMPILER=g++-6
26+
compiler: gcc
27+
os: linux
28+
addons:
29+
apt:
30+
sources: &sources
31+
- ubuntu-toolchain-r-test

Diff for: ‎src/unittest/test_settings.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TestSettings : public TestBase {
3232
void testAllSettings();
3333

3434
static const char *config_text_before;
35-
static const char *config_text_after;
35+
static const std::string config_text_after;
3636
};
3737

3838
static TestSettings g_test_instance;
@@ -69,7 +69,7 @@ const char *TestSettings::config_text_before =
6969
"np_terrain = 5, 40, (250, 250, 250), 12341, 5, 0.7, 2.4\n"
7070
"zoop = true";
7171

72-
const char *TestSettings::config_text_after =
72+
const std::string TestSettings::config_text_after =
7373
"leet = 1337\n"
7474
"leetleet = 13371337\n"
7575
"leetleet_neg = -13371337\n"
@@ -197,7 +197,10 @@ void TestSettings::testAllSettings()
197197
UASSERT(s.updateConfigObject(is, os, "", 0) == true);
198198
//printf(">>>> expected config:\n%s\n", TEST_CONFIG_TEXT_AFTER);
199199
//printf(">>>> actual config:\n%s\n", os.str().c_str());
200+
#if __cplusplus < 201103L
201+
// This test only works in older C++ versions than C++11 because we use unordered_map
200202
UASSERT(os.str() == config_text_after);
203+
#endif
201204
} catch (SettingNotFoundException &e) {
202205
UASSERT(!"Setting not found!");
203206
}

Diff for: ‎src/unittest/test_threading.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class AtomicTestThread : public Thread {
163163
void TestThreading::testAtomicSemaphoreThread()
164164
{
165165
Atomic<u32> val;
166+
val = 0;
166167
Semaphore trigger;
167168
static const u8 num_threads = 4;
168169

Diff for: ‎util/travis/before_install.sh

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
#!/bin/bash -e
22

33
if [[ $TRAVIS_OS_NAME == "linux" ]]; then
4-
if [[ $CC == "clang" ]]; then
5-
export PATH="/usr/bin/:$PATH"
6-
sudo sh -c 'echo "deb http://ppa.launchpad.net/eudoxos/llvm-3.1/ubuntu precise main" >> /etc/apt/sources.list'
7-
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 92DE8183
8-
sudo apt-get update
9-
sudo apt-get install llvm-3.1
10-
sudo apt-get install clang
11-
fi
124
sudo apt-get update
13-
sudo apt-get install p7zip-full
5+
sudo apt-get install p7zip-full $COMPILER
146
fi
157

168
if [[ $PLATFORM == "Unix" ]]; then

Diff for: ‎util/travis/script.sh

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ if [[ $PLATFORM == "Unix" ]]; then
44
mkdir -p travisbuild
55
cd travisbuild || exit 1
66
CMAKE_FLAGS=''
7+
if [[ $COMPILER == "g++-6" ]]; then
8+
export CC=gcc-6
9+
export CXX=g++-6
10+
fi
711
# Clang builds with FreeType fail on Travis
812
if [[ $CC == "clang" ]]; then
913
CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE'

0 commit comments

Comments
 (0)
Please sign in to comment.