c++linuxcmaketravis-cicxxtest

Travis-Ci Install and run CxxTest


I am trying to add Travis-Ci support for my open source project hosted on Github

Problem appears when CMake tries to find CxxTest. Travis-Ci runs on old Ubuntu version, in which CxxTest is not trusted. I achieved some results. At this state CxxTest installs fine, but CMake is unable to find cxxtestgen.

Question: How do I correctly install and use CxxTest in Travis-Ci ?

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 log

$ 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.

Solution

  • I found answer by myself.

    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