From d768c499803768cfbeac84ddf55308d2945d8efa Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 8 Apr 2018 00:49:51 +0200
Subject: [PATCH] travis: Separate compiling and testing
---
.travis.yml | 48 ++++++++++++++++++++++--------------
common/travis/configure.sh | 1 +
common/travis/environment.sh | 3 ---
common/travis/summary.sh | 3 +++
common/travis/tests.sh | 23 ++++++++---------
5 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 13201218..f8805295 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,9 +2,36 @@ sudo: required
dist: trusty
language: cpp
-compiler:
- - clang
- - gcc
+env:
+ global:
+ - LLVM_VERSION="3.8.1"
+ - LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
+ - LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
+ - LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
+ - CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz"
+ - PYTHONPATH="/usr/lib/python2.7/dist-packages:${PYTHONPATH}"
+ - JOBS=4
+ - POLYBAR_BUILD_TYPE="compile"
+
+script: source ${TRAVIS_BUILD_DIR}/common/travis/build.sh
+
+matrix:
+ include:
+ - compiler: clang
+ env: BUILD_TYPE=Release
+
+ - compiler: clang
+ env: BUILD_TYPE=Debug
+
+ - compiler: gcc
+ env: BUILD_TYPE=Debug POLYBAR_BUILD_TYPE=tests
+ script: ${TRAVIS_BUILD_DIR}/common/travis/tests.sh
+
+ - compiler: gcc
+ env: BUILD_TYPE=Release
+
+ - compiler: gcc
+ env: BUILD_TYPE=Debug
addons:
apt:
@@ -37,17 +64,6 @@ addons:
- xutils-dev
- libgtest-dev
-env:
- global:
- - BUILD_TESTS="ON"
- - LLVM_VERSION="3.8.1"
- - LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
- - LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
- - LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
- - CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz"
- - PYTHONPATH="/usr/lib/python2.7/dist-packages:${PYTHONPATH}"
- - JOBS=4
-
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps/cmake
@@ -66,10 +82,6 @@ before_script:
- source ${TRAVIS_BUILD_DIR}/common/travis/summary.sh
- source ${TRAVIS_BUILD_DIR}/common/travis/configure.sh
-script:
- - source ${TRAVIS_BUILD_DIR}/common/travis/build.sh
- - source ${TRAVIS_BUILD_DIR}/common/travis/tests.sh
-
notifications:
email: false
irc:
diff --git a/common/travis/configure.sh b/common/travis/configure.sh
index 5052eb0d..dbb8a4a7 100755
--- a/common/travis/configure.sh
+++ b/common/travis/configure.sh
@@ -5,4 +5,5 @@ cmake \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
+ -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" ..
diff --git a/common/travis/environment.sh b/common/travis/environment.sh
index 51782395..92e7357f 100755
--- a/common/travis/environment.sh
+++ b/common/travis/environment.sh
@@ -7,7 +7,4 @@ if [ "${CXX:0:7}" = "clang++" ]; then
elif [ "${CXX:0:3}" = "g++" ]; then
export CXX="g++-5"
export CC="gcc-5"
-elif [ "${CXX:0:3}" = "gcc" ]; then
- export CXX="g++-5"
- export CC="gcc-5"
fi
diff --git a/common/travis/summary.sh b/common/travis/summary.sh
index 0b8c8145..be91f660 100755
--- a/common/travis/summary.sh
+++ b/common/travis/summary.sh
@@ -9,6 +9,9 @@ echo "cmake --version"
cmake --version
echo "PATH=${PATH}"
+echo "CXX=${CXX}"
+echo "CC=${CC}"
echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
+echo "JOBS=${JOBS}"
diff --git a/common/travis/tests.sh b/common/travis/tests.sh
index 95f419f6..7d2d1ce3 100755
--- a/common/travis/tests.sh
+++ b/common/travis/tests.sh
@@ -1,15 +1,16 @@
#!/bin/bash
r=0
-if [ "${BUILD_TESTS:-OFF}" = "ON" ]; then
- for test in tests/unit_test.*; do
- [ -x "$test" ] || continue
- if $test; then
- printf "\033[1;32m%s\033[0m\n" "${test##*/} passed"
- else
- r=1
- printf "\033[1;31m%s\033[0m\n" "${test##*/} failed"
- fi
- done
-fi
+make -j"${JOBS}" all_unit_tests
+
+for test in tests/unit_test.*; do
+ [ -x "$test" ] || continue
+
+ if $test; then
+ printf "\033[1;32m%s\033[0m\n" "${test##*/} passed"
+ else
+ r=1
+ printf "\033[1;31m%s\033[0m\n" "${test##*/} failed"
+ fi
+done
exit $r