Be a bit more robust in the face of out-of-memory errors.
[platform/upstream/libexif.git] / .travis.yml
index 2d2b8c6..7e46f68 100644 (file)
@@ -4,6 +4,9 @@ sudo: false
 
 language: c
 
+git:
+  depth: 1
+
 # Install autopoint on Ubuntu (needed for gettext)
 addons:
   apt:
@@ -11,6 +14,7 @@ addons:
     - autopoint
 
 env:
+  # More configurations are configured in the matrix section
   matrix:
     - CONFIG=normal
     - CONFIG=c90
@@ -18,21 +22,96 @@ env:
   global:
     - MAKEFLAGS='-j 2'
 
+compiler:
+  - clang
+  - gcc
+
+os:
+  - linux
+  - osx
+
+matrix:
+  include:
+  - os: linux
+    addons:
+      apt:
+        sources:
+          - llvm-toolchain-trusty-6.0
+          - ubuntu-toolchain-r-test
+        packages:
+          - autopoint
+          - clang-6.0
+    compiler: clang
+    env:
+      - CONFIG=clang6
+  - os: linux
+    addons:
+      apt:
+        sources:
+          - ubuntu-toolchain-r-test
+        packages:
+          - autopoint
+          - g++-8
+    compiler: gcc
+    env:
+      - CONFIG=gcc8
+  - os: linux
+    addons:
+      apt:
+        sources:
+          - llvm-toolchain-trusty-6.0
+          - ubuntu-toolchain-r-test
+        packages:
+          - autopoint
+          - clang-6.0
+          - libtool
+    compiler: clang
+    # Required for -fsanitize=undefined
+    # see https://github.com/travis-ci/travis-ci/issues/9033
+    sudo: required
+    env:
+      - CONFIG=sanitize
+  - os: linux
+    addons:
+      apt:
+        packages:
+          - autopoint
+          - libpopt-dev
+          - subversion
+    compiler: gcc
+    env:
+      - CONFIG=coverage
+
+install:
+  - |
+    if [ "$CONFIG" = "coverage" ] ; then
+      set -e
+      pip install --user cpp-coveralls
+      cd "$HOME"
+      git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
+      cd libexif-testsuite
+      mkdir src
+      ln -s "$TRAVIS_BUILD_DIR" src/libexif
+      ./build-config.sh
+      autoreconf -sivf
+      cd "$TRAVIS_BUILD_DIR"
+    fi
+
 script:
   # Ensure brew gettext is in the PATH so autopoint is found on OS X
   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
-  - ./configure --prefix="${HOME}" CFLAGS="$CFLAGS" || { tail -300 config.log; false; }
+  - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
+  - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export export CC=gcc-8; fi
+  - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined'; export CC=clang-6.0; fi
+  - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; LDFLAGS=--coverage; fi
+  - ./configure --prefix="${HOME}"/install CFLAGS="$CFLAGS" ${LDFLAGS:+LDFLAGS=$LDFLAGS} || { tail -300 config.log; false; }
   - make
-  - make check
+  - make check || { tail -300 test*/test-suite.log; false; }
   - make install
+  - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
 
-compiler:
-  - clang
-  - gcc
-
-os:
-  - linux
-  - osx
+after_success:
+  - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi