Travis-Ci 安装和 运行 CxxTest

Travis-Ci Install and run CxxTest

我正在尝试为我的 open source project hosted on Github

添加 Travis-Ci 支持

CMake 试图找到 CxxTest 时出现问题。 Travis-Ci 在旧 Ubuntu 版本上运行,其中 CxxTest 不受信任。我取得了一些成果。在此状态 CxxTest 安装正常,但 CMake 无法找到 cxxtestgen

问题:如何在Travis-Ci中正确安装和使用CxxTest

Build log on Travis

Travis.yml

language: cpp

compiler:
  - gcc
before_install:
  - lsb_release -c
  - lsb_release -r
  - sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu vivid main universe multiverse restricted'
  - sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu trusty main universe multiverse restricted'
  - sudo apt-key update
  - sudo apt-get -y update
install:
  - sudo apt-get --no-install-recommends -y install cxxtest;
  - sudo find / -type f -name "cxxtestgen*"
  - sudo ln /usr/share/cxxtest/cxxtest/cxxtestgen.py /usr/bin/cxxtestgen.py
  - sudo find / -type f -name "cxxtestgen*"
  - echo $PATH
before_script:
  - cmake .
script: make

CMake 日志

$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find CxxTest (missing: CXXTEST_PERL_TESTGEN_EXECUTABLE)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindCxxTest.cmake:179 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  test/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
The command "cmake ." failed and exited with 1 during .
Your build has been stopped.

我自己找到了答案。

language: cpp

compiler:
  - gcc

cache:
  apt: true

addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    - george-edison55/cmake-3.x
    packages:
    - gcc-6
    - g++-6
    - libboost-dev
    - gcc-multilib
    - gcc-6-multilib
    - g++-multilib
    - g++-6-multilib
    - libc6-dev-i386
    - libc6-i386
    - cxxtest
    - cmake

before_install:
  - echo `getconf _NPROCESSORS_ONLN`
  - lsb_release -c
  - lsb_release -r
install:
  - if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
before_script:
  - cmake --version
  - cmake .
script: 
  - make -j$((2 * `getconf _NPROCESSORS_ONLN`))

sudo: false
dist: trusty