Fixed a compiler warning in test-fuzzer
[platform/upstream/libexif.git] / .travis.yml
1 # Travis CI configuration file
2
3 sudo: false
4
5 language: c
6
7 git:
8   depth: 1
9
10 # Install autopoint on Ubuntu (needed for gettext)
11 addons:
12   apt:
13     packages:
14     - autopoint
15
16 env:
17   # More configurations are configured in the matrix section
18   matrix:
19     - CONFIG=normal
20     - CONFIG=c90
21     - CONFIG=stackprotect
22   global:
23     - MAKEFLAGS='-j 2'
24
25 compiler:
26   - clang
27   - gcc
28
29 os:
30   - linux
31   - osx
32
33 matrix:
34   include:
35   - env: CONFIG=clang6
36     os: linux
37     compiler: clang
38     addons:
39       apt:
40         sources:
41           - llvm-toolchain-trusty-6.0
42           - ubuntu-toolchain-r-test
43         packages:
44           - autopoint
45           - clang-6.0
46   - env: CONFIG=gcc8
47     os: linux
48     compiler: gcc
49     addons:
50       apt:
51         sources:
52           - ubuntu-toolchain-r-test
53         packages:
54           - autopoint
55           - g++-8
56   - env: CONFIG=arm-cross
57     os: linux
58     compiler: gcc
59     addons:
60       apt:
61         packages:
62           - autopoint
63           - gcc-4.8-arm-linux-gnueabihf
64           - libc6-dev-armhf-cross
65   - env: CONFIG=musl
66     os: linux
67     compiler: gcc
68     addons:
69       apt:
70         packages:
71           - autopoint
72           - musl-tools
73   - env: CONFIG=sanitize
74     os: linux
75     compiler: clang
76     addons:
77       apt:
78         sources:
79           - llvm-toolchain-trusty-6.0
80           - ubuntu-toolchain-r-test
81         packages:
82           - autopoint
83           - clang-6.0
84           - libtool
85     # Required for -fsanitize=undefined
86     # see https://github.com/travis-ci/travis-ci/issues/9033
87     sudo: required
88   - env: CONFIG=coverage
89     os: linux
90     compiler: gcc
91     addons:
92       apt:
93         packages:
94           - autopoint
95           - libpopt-dev
96           - subversion
97     cache:
98       directories:
99         - $HOME/failmalloc
100
101 install:
102   - |
103     if [ "$CONFIG" = "coverage" ] ; then
104       set -e
105       pip install --user cpp-coveralls
106       cd "$HOME"
107       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
108       cd libexif-testsuite
109       mkdir src
110       ln -s "$TRAVIS_BUILD_DIR" src/libexif
111       ./build-config.sh
112       autoreconf -sivf
113       cd "$HOME"
114       # Failmalloc for improved test coverage
115       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
116         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
117         tar xaf failmalloc-1.0.tar.gz
118         cd failmalloc-1.0
119         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
120         ./configure --prefix="$HOME/failmalloc"
121         make
122         make install
123       fi
124       cd "$TRAVIS_BUILD_DIR"
125     fi
126
127 script:
128   # Ensure brew gettext is in the PATH so autopoint is found on OS X
129   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
130   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
131   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
132   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
133   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
134   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
135   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
136   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
137   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined'; export CC=clang-6.0; fi
138   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
139   - ./configure --prefix="${HOME}"/install CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
140
141   - make V=1
142   # Skip tests when cross compiling.
143   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
144   - make V=1 install
145
146   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
147
148 after_success:
149   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi