Add a MUSL build on Travis.
[platform/upstream/libexif.git] / .travis.yml
index 0f5532a..0c07a10 100644 (file)
@@ -32,7 +32,9 @@ os:
 
 matrix:
   include:
-  - os: linux
+  - env: CONFIG=clang6
+    os: linux
+    compiler: clang
     addons:
       apt:
         sources:
@@ -41,10 +43,9 @@ matrix:
         packages:
           - autopoint
           - clang-6.0
-    compiler: clang
-    env:
-      - CONFIG=clang6
-  - os: linux
+  - env: CONFIG=gcc8
+    os: linux
+    compiler: gcc
     addons:
       apt:
         sources:
@@ -52,10 +53,26 @@ matrix:
         packages:
           - autopoint
           - g++-8
+  - env: CONFIG=arm-cross
+    os: linux
+    compiler: gcc
+    addons:
+      apt:
+        packages:
+          - autopoint
+          - gcc-4.8-arm-linux-gnueabihf
+          - libc6-dev-armhf-cross
+  - env: CONFIG=musl
+    os: linux
     compiler: gcc
-    env:
-      - CONFIG=gcc8
-  - os: linux
+    addons:
+      apt:
+        packages:
+          - autopoint
+          - musl-tools
+  - env: CONFIG=sanitize
+    os: linux
+    compiler: clang
     addons:
       apt:
         sources:
@@ -65,22 +82,21 @@ matrix:
           - 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
+  - env: CONFIG=coverage
+    os: linux
+    compiler: gcc
     addons:
       apt:
         packages:
           - autopoint
           - libpopt-dev
           - subversion
-    compiler: gcc
-    env:
-      - CONFIG=coverage
+    cache:
+      directories:
+        - $HOME/failmalloc
 
 install:
   - |
@@ -94,6 +110,17 @@ install:
       ln -s "$TRAVIS_BUILD_DIR" src/libexif
       ./build-config.sh
       autoreconf -sivf
+      cd "$HOME"
+      # Failmalloc for improved test coverage
+      if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
+        curl -fsSORL https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
+        tar xaf failmalloc-1.0.tar.gz
+        cd failmalloc-1.0
+        sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
+        ./configure --prefix="$HOME/failmalloc"
+        make
+        make install
+      fi
       cd "$TRAVIS_BUILD_DIR"
     fi
 
@@ -104,13 +131,18 @@ script:
   - 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
   - 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" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
+  - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
+  - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; 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; 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 "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
+  - ./configure --prefix="${HOME}"/install CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
+
+  - make V=1
+  # Skip tests when cross compiling.
+  - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
+  - make V=1 install
+
   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
 
 after_success: