Miscellaneous travis-ci updates/fixes

- For the debian/buster docker build (GCC 7/C++17) install and use the
  system `catch` package; this also renames "COMPILER_PACKAGES" to
  "EXTRA_PACKAGES" since it now contains a non-compiler package.

- Add a status message indicating the catch version being used for
  compiling the embedded tests

- Simplify some bash code by using VAR+=" foo" to append (rather than
  VAR="${VAR} foo"

- Fix CMAKE_INCLUDE_PATH appending: it was prepending the ':' but not
  the existing $CMAKE_INCLUDE_PATH value and so would end up with
  ":/eigen-path" if CMAKE_INCLUDE_PATH was already set.  (This wasn't
  bug that was actually noticed since currently nothing else sets it).
This commit is contained in:
Jason Rhinelander 2017-10-22 12:25:18 -03:00 committed by Wenzel Jakob
parent 6519388f5c
commit fbb2ef7ea1
2 changed files with 12 additions and 10 deletions

View File

@ -100,22 +100,22 @@ before_install:
if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -n "$CLANG" ]; then if [ -n "$CLANG" ]; then
export CXX=clang++-$CLANG CC=clang-$CLANG export CXX=clang++-$CLANG CC=clang-$CLANG
COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev" EXTRA_PACKAGES+=" clang-$CLANG llvm-$CLANG-dev"
else else
if [ -z "$GCC" ]; then GCC=4.8 if [ -z "$GCC" ]; then GCC=4.8
else COMPILER_PACKAGES=g++-$GCC else EXTRA_PACKAGES+=" g++-$GCC"
fi fi
export CXX=g++-$GCC CC=gcc-$GCC export CXX=g++-$GCC CC=gcc-$GCC
fi fi
if [ "$GCC" = "6" ]; then DOCKER=${ARCH:+$ARCH/}debian:stretch if [ "$GCC" = "6" ]; then DOCKER=${ARCH:+$ARCH/}debian:stretch
elif [ "$GCC" = "7" ]; then DOCKER=debian:buster elif [ "$GCC" = "7" ]; then DOCKER=debian:buster EXTRA_PACKAGES+=" catch" DOWNLOAD_CATCH=OFF
fi fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export CXX=clang++ CC=clang; export CXX=clang++ CC=clang;
fi fi
if [ -n "$CPP" ]; then CPP=-std=c++$CPP; fi if [ -n "$CPP" ]; then CPP=-std=c++$CPP; fi
if [ "${PYTHON:0:1}" = "3" ]; then PY=3; fi if [ "${PYTHON:0:1}" = "3" ]; then PY=3; fi
if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_BUILD_TYPE=Debug"; fi if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS+=" -DCMAKE_BUILD_TYPE=Debug"; fi
- | - |
# Initialize environment # Initialize environment
set -e set -e
@ -133,7 +133,7 @@ before_install:
if [ "$PYPY" = "5.8" ]; then if [ "$PYPY" = "5.8" ]; then
curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-linux64.tar.bz2 | tar xj curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-linux64.tar.bz2 | tar xj
PY_CMD=$(echo `pwd`/pypy2-v5.8.0-linux64/bin/pypy) PY_CMD=$(echo `pwd`/pypy2-v5.8.0-linux64/bin/pypy)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD" CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
else else
PY_CMD=python$PYTHON PY_CMD=python$PYTHON
if [ "$TRAVIS_OS_NAME" = "osx" ]; then if [ "$TRAVIS_OS_NAME" = "osx" ]; then
@ -157,12 +157,12 @@ install:
if [ -n "$DOCKER" ]; then if [ -n "$DOCKER" ]; then
if [ -n "$DEBUG" ]; then if [ -n "$DEBUG" ]; then
PY_DEBUG="python$PYTHON-dbg python$PY-scipy-dbg" PY_DEBUG="python$PYTHON-dbg python$PY-scipy-dbg"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm" CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
fi fi
$SCRIPT_RUN_PREFIX sh -c "for s in 0 15; do sleep \$s; \ $SCRIPT_RUN_PREFIX sh -c "for s in 0 15; do sleep \$s; \
apt-get -qy --no-install-recommends install \ apt-get -qy --no-install-recommends install \
$PY_DEBUG python$PYTHON-dev python$PY-pytest python$PY-scipy \ $PY_DEBUG python$PYTHON-dev python$PY-pytest python$PY-scipy \
libeigen3-dev libboost-dev cmake make ${COMPILER_PACKAGES} && break; done" libeigen3-dev libboost-dev cmake make ${EXTRA_PACKAGES} && break; done"
else else
if [ "$CLANG" = "5.0" ]; then if [ "$CLANG" = "5.0" ]; then
@ -195,7 +195,7 @@ install:
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
tar xzf eigen.tar.gz tar xzf eigen.tar.gz
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+:}$PWD/eigen-eigen-67e894c6cd8f" export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+$CMAKE_INCLUDE_PATH:}$PWD/eigen-eigen-67e894c6cd8f"
fi fi
set +e set +e
script: script:
@ -203,7 +203,7 @@ script:
-DPYBIND11_PYTHON_VERSION=$PYTHON -DPYBIND11_PYTHON_VERSION=$PYTHON
-DPYBIND11_CPP_STANDARD=$CPP -DPYBIND11_CPP_STANDARD=$CPP
-DPYBIND11_WERROR=${WERROR:-ON} -DPYBIND11_WERROR=${WERROR:-ON}
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=${DOWNLOAD_CATCH:-ON}
- $SCRIPT_RUN_PREFIX make pytest -j 2 - $SCRIPT_RUN_PREFIX make pytest -j 2
- $SCRIPT_RUN_PREFIX make cpptest -j 2 - $SCRIPT_RUN_PREFIX make cpptest -j 2
- if [ -n "$CMAKE" ]; then $SCRIPT_RUN_PREFIX make test_cmake_build; fi - if [ -n "$CMAKE" ]; then $SCRIPT_RUN_PREFIX make test_cmake_build; fi

View File

@ -5,7 +5,9 @@ if(${PYTHON_MODULE_EXTENSION} MATCHES "pypy")
endif() endif()
find_package(Catch 1.9.3) find_package(Catch 1.9.3)
if(NOT CATCH_FOUND) if(CATCH_FOUND)
message(STATUS "Building interpreter tests using Catch v${CATCH_VERSION}")
else()
message(STATUS "Catch not detected. Interpreter tests will be skipped. Install Catch headers" message(STATUS "Catch not detected. Interpreter tests will be skipped. Install Catch headers"
" manually or use `cmake -DDOWNLOAD_CATCH=1` to fetch them automatically.") " manually or use `cmake -DDOWNLOAD_CATCH=1` to fetch them automatically.")
return() return()