Add code coverage using libexif-testsuite.
authorDan Fandrich <dan@coneharvesters.com>
Sat, 27 Oct 2018 10:57:21 +0000 (12:57 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Sun, 28 Oct 2018 12:42:57 +0000 (13:42 +0100)
This runs the libexif, exif and libexif-testsuite tests to get a more
complete indication of total test coverage.

.travis.yml

index 95d0620..c1fb826 100644 (file)
@@ -22,6 +22,14 @@ env:
   global:
     - MAKEFLAGS='-j 2'
 
+compiler:
+  - clang
+  - gcc
+
+os:
+  - linux
+  - osx
+
 matrix:
   include:
   - os: linux
@@ -63,6 +71,31 @@ matrix:
     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
@@ -73,15 +106,12 @@ script:
   - 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
-  - ./configure --prefix="${HOME}" CFLAGS="$CFLAGS" || { tail -300 config.log; false; }
+  - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; LDFLAGS=--coverage; export MAKEFLAGS='-j 1'; fi
+  - ./configure --prefix="${HOME}"/install CFLAGS="$CFLAGS" ${LDFLAGS:+LDFLAGS=$LDFLAGS} || { tail -300 config.log; false; }
   - make
   - 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