travis: Separate compiling and testing

This commit is contained in:
patrick96 2018-04-08 00:49:51 +02:00 committed by Patrick Ziegler
parent eed4d3ffc8
commit d768c49980
5 changed files with 46 additions and 32 deletions

View File

@ -2,9 +2,36 @@ sudo: required
dist: trusty dist: trusty
language: cpp language: cpp
compiler: env:
- clang global:
- gcc - 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: addons:
apt: apt:
@ -37,17 +64,6 @@ addons:
- xutils-dev - xutils-dev
- libgtest-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: cache:
directories: directories:
- ${TRAVIS_BUILD_DIR}/deps/cmake - ${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/summary.sh
- source ${TRAVIS_BUILD_DIR}/common/travis/configure.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: notifications:
email: false email: false
irc: irc:

View File

@ -5,4 +5,5 @@ cmake \
-DCMAKE_C_COMPILER="${CC}" \ -DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \ -DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" .. -DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" ..

View File

@ -7,7 +7,4 @@ if [ "${CXX:0:7}" = "clang++" ]; then
elif [ "${CXX:0:3}" = "g++" ]; then elif [ "${CXX:0:3}" = "g++" ]; then
export CXX="g++-5" export CXX="g++-5"
export CC="gcc-5" export CC="gcc-5"
elif [ "${CXX:0:3}" = "gcc" ]; then
export CXX="g++-5"
export CC="gcc-5"
fi fi

View File

@ -9,6 +9,9 @@ echo "cmake --version"
cmake --version cmake --version
echo "PATH=${PATH}" echo "PATH=${PATH}"
echo "CXX=${CXX}"
echo "CC=${CC}"
echo "CXXFLAGS=${CXXFLAGS}" echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}" echo "LDFLAGS=${LDFLAGS}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
echo "JOBS=${JOBS}"

View File

@ -1,7 +1,9 @@
#!/bin/bash #!/bin/bash
r=0 r=0
if [ "${BUILD_TESTS:-OFF}" = "ON" ]; then
for test in tests/unit_test.*; do make -j"${JOBS}" all_unit_tests
for test in tests/unit_test.*; do
[ -x "$test" ] || continue [ -x "$test" ] || continue
if $test; then if $test; then
@ -10,6 +12,5 @@ if [ "${BUILD_TESTS:-OFF}" = "ON" ]; then
r=1 r=1
printf "\033[1;31m%s\033[0m\n" "${test##*/} failed" printf "\033[1;31m%s\033[0m\n" "${test##*/} failed"
fi fi
done done
fi
exit $r exit $r