Thursday, November 5, 2015

Default Template

[Edited 2015-12-04 to add LSAN, MSAN]

For reference, here's the default Travis configuration that I use to get a selection of builds running against an Autotools-based projects that has a make check target. It includes the base {linux, osx} × {gcc, clang} matrix, together with sanitizer runs (ASAN, UBSAN) and run to generate code coverage information for Coveralls.

language: c
sudo: false
matrix:
    include:
        - os: linux
          compiler: gcc
          env: BUILD_TYPE=normal
        - os: linux
          compiler: clang
          env: BUILD_TYPE=normal
        - os: linux
          compiler: gcc
          env: BUILD_TYPE=coverage
        - os: linux
          compiler: clang
          env: BUILD_TYPE=ubsan
        - os: linux
          compiler: clang
          env: BUILD_TYPE=asan
        - os: linux
          compiler: clang
          env: BUILD_TYPE=lsan
        - os: linux
          compiler: clang
          env: BUILD_TYPE=msan
        - os: osx
          compiler: gcc
          env: BUILD_TYPE=normal
        - os: osx
          compiler: clang
          env: BUILD_TYPE=normal
install:
    - pip install --user 'requests[security]'
    - pip install --user cpp-coveralls
before_script:
    - |
        if [ "$BUILD_TYPE" = "coverage" ]; then
             export CFLAGS="-fprofile-arcs -ftest-coverage"
             export LDFLAGS="-fprofile-arcs -ftest-coverage"
        fi
    - |
         if [ "$BUILD_TYPE" = "asan" ]; then
             export CFLAGS=-fsanitize=address
             export LDFLAGS=-fsanitize=address
         fi
    - |
         if [ "$BUILD_TYPE" = "lsan" ]; then
             export CFLAGS=-fsanitize=leak
             export LDFLAGS=-fsanitize=leak
         fi
    - |
         if [ "$BUILD_TYPE" = "msan" ]; then
             export CFLAGS=-fsanitize=memory
             export LDFLAGS=-fsanitize=memory
         fi
    - |
         if [ "$BUILD_TYPE" = "ubsan" ]; then
             export UBSAN_FLAGS="-fsanitize=undefined"
             export CFLAGS=$UBSAN_FLAGS
             export LDFLAGS=$UBSAN_FLAGS
         fi
script:
    - ./configure && make && make check
    - |
          if [ "$BUILD_TYPE" = "coverage" ]; then
              cpp-coveralls --gcov-options '\-lp'
          fi

No comments:

Post a Comment