From 12b3cc0d7b28cee34f73d099b8f3a611590356fa Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Thu, 4 May 2017 12:47:12 +0200 Subject: [PATCH] Support new Debian version of gmock and add testing for debian systems (#236) --- .travis.yml | 8 +++++--- Dockerfile.jessie | 25 +++++++++++++++++++++++++ Dockerfile.stretch | 25 +++++++++++++++++++++++++ Dockerfile.xenial | 2 +- cmake/modules/FindGMock.cmake | 11 ++++++----- scripts/save_docker_cache.sh | 2 +- 6 files changed, 63 insertions(+), 10 deletions(-) create mode 100644 Dockerfile.jessie create mode 100644 Dockerfile.stretch diff --git a/.travis.yml b/.travis.yml index 3c42c88..9ba2ffe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,12 +22,14 @@ cache: - /home/travis/docker/ env: - - UBUNTU_RELEASE=trusty DOCKER_CACHE_FILE=/home/travis/docker/trusty-cache.tar.gz - - UBUNTU_RELEASE=xenial DOCKER_CACHE_FILE=/home/travis/docker/xenial-cache.tar.gz + - LSB_RELEASE=trusty DOCKER_CACHE_FILE=/home/travis/docker/trusty-cache.tar.gz + - LSB_RELEASE=xenial DOCKER_CACHE_FILE=/home/travis/docker/xenial-cache.tar.gz + - LSB_RELEASE=jessie DOCKER_CACHE_FILE=/home/travis/docker/jessie-cache.tar.gz + - LSB_RELEASE=stretch DOCKER_CACHE_FILE=/home/travis/docker/stretch-cache.tar.gz before_install: scripts/load_docker_cache.sh install: true script: - - docker build ${TRAVIS_BUILD_DIR} -t cartographer:${UBUNTU_RELEASE} -f Dockerfile.${UBUNTU_RELEASE} + - docker build ${TRAVIS_BUILD_DIR} -t cartographer:${LSB_RELEASE} -f Dockerfile.${LSB_RELEASE} - scripts/save_docker_cache.sh diff --git a/Dockerfile.jessie b/Dockerfile.jessie new file mode 100644 index 0000000..29945ca --- /dev/null +++ b/Dockerfile.jessie @@ -0,0 +1,25 @@ +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:jessie + +# This base image doesn't ship with sudo. +RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* + +COPY scripts/install_debs.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_ceres.sh cartographer/scripts/ +RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver +COPY . cartographer +RUN cartographer/scripts/install_cartographer.sh && rm -rf cartographer diff --git a/Dockerfile.stretch b/Dockerfile.stretch new file mode 100644 index 0000000..2f350d5 --- /dev/null +++ b/Dockerfile.stretch @@ -0,0 +1,25 @@ +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:stretch + +# This base image doesn't ship with sudo. +RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* + +COPY scripts/install_debs.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_ceres.sh cartographer/scripts/ +RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver +COPY . cartographer +RUN cartographer/scripts/install_cartographer.sh && rm -rf cartographer diff --git a/Dockerfile.xenial b/Dockerfile.xenial index 0933b6f..edd3029 100644 --- a/Dockerfile.xenial +++ b/Dockerfile.xenial @@ -14,7 +14,7 @@ FROM ubuntu:xenial -# Xenial's base image doesn't ship with sudo. +# This base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* COPY scripts/install_debs.sh cartographer/scripts/ diff --git a/cmake/modules/FindGMock.cmake b/cmake/modules/FindGMock.cmake index 22b0f86..8b486ca 100644 --- a/cmake/modules/FindGMock.cmake +++ b/cmake/modules/FindGMock.cmake @@ -43,17 +43,18 @@ list(APPEND GMOCK_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}) if(NOT GMOCK_LIBRARIES) # If no system-wide gmock found, then find src version. # Ubuntu might have this. - find_path(GMOCK_SRC_DIR gmock/CMakeLists.txt + find_path(GMOCK_SRC_DIR src/gmock.cc HINTS ENV GMOCK_DIR - PATH_SUFFIXES src PATHS - /usr + /usr/src/googletest/googlemock + /usr/src/gmock ) if(GMOCK_SRC_DIR) # If src version found, build it. - add_subdirectory(${GMOCK_SRC_DIR}/gmock "${CMAKE_CURRENT_BINARY_DIR}/gmock") - set(GMOCK_INCLUDE_DIRS "${GMOCK_SRC_DIR}/gmock/gtest/include") + add_subdirectory(${GMOCK_SRC_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock") + # The next line is needed for Ubuntu Trusty. + set(GMOCK_INCLUDE_DIRS "${GMOCK_SRC_DIR}/gtest/include") set(GMOCK_LIBRARIES gmock_main) endif() endif() diff --git a/scripts/save_docker_cache.sh b/scripts/save_docker_cache.sh index dfc5343..a9a3a4b 100755 --- a/scripts/save_docker_cache.sh +++ b/scripts/save_docker_cache.sh @@ -24,6 +24,6 @@ set -o pipefail if [[ ${TRAVIS_BRANCH} == "master" ]] && [[ ${TRAVIS_PULL_REQUEST} == "false" ]]; then mkdir -p $(dirname ${DOCKER_CACHE_FILE}); - docker save $(docker history -q cartographer:${UBUNTU_RELEASE} | + docker save $(docker history -q cartographer:${LSB_RELEASE} | grep -v '') | gzip > ${DOCKER_CACHE_FILE}; fi