Add a failsafe on the maximum number of Canon MakerNote subtags.
[platform/upstream/libexif.git] / .travis.yml
1 # Travis CI configuration file
2
3 sudo: false
4
5 language: c
6
7 git:
8   # Set to 10 instead of 1 to avoid problems when the most recent commits have [skip ci]
9   depth: 10
10
11 # Install autopoint on Ubuntu (needed for gettext)
12 # This is ignored on bionic for some reason (see below).
13 addons:
14   apt:
15     packages:
16     - autopoint
17
18 env:
19   # More configurations are configured in the matrix section
20   matrix:
21     - CONFIG=normal
22     - CONFIG=c90
23     - CONFIG=stackprotect
24     - CONFIG=disable-nls
25   global:
26     - MAKEFLAGS='-j 2'
27
28 compiler:
29   - clang
30   - gcc
31
32 os:
33   - linux
34   - osx
35
36 matrix:
37   include:
38   - env: CONFIG=normal DIST=bionic
39     os: linux
40     dist: bionic
41     compiler: gcc
42   - env: CONFIG=normal DIST=bionic
43     os: linux
44     dist: bionic
45     compiler: clang
46   - env: CONFIG=clang6 DIST=xenial
47     os: linux
48     dist: xenial
49     compiler: clang
50     addons:
51       apt:
52         packages:
53           - autopoint
54           - clang-6.0
55   - env: CONFIG=clang8 DIST=xenial
56     os: linux
57     dist: xenial
58     compiler: clang
59     addons:
60       apt:
61         sources:
62           - llvm-toolchain-trusty-8
63         packages:
64           - autopoint
65           - clang-8
66   - env: CONFIG=clang9 DIST=xenial
67     os: linux
68     dist: xenial
69     compiler: clang
70     addons:
71       apt:
72         sources:
73           sourceline:
74             - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
75           key_url:
76             - https://apt.llvm.org/llvm-snapshot.gpg.key
77         packages:
78           - autopoint
79           - clang-9
80   - env: CONFIG=clang10 DIST=xenial
81     os: linux
82     dist: xenial
83     compiler: clang
84     addons:
85       apt:
86         sources:
87           sourceline:
88             - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
89           key_url:
90             - https://apt.llvm.org/llvm-snapshot.gpg.key
91         packages:
92           - autopoint
93           - clang-10
94   - env: CONFIG=gcc8 DIST=xenial
95     os: linux
96     dist: xenial
97     compiler: gcc
98     addons:
99       apt:
100         sources:
101           sourceline:
102             - ppa:ubuntu-toolchain-r/test
103         packages:
104           - autopoint
105           - g++-8
106   - env: CONFIG=gcc9 DIST=xenial
107     os: linux
108     dist: xenial
109     compiler: gcc
110     addons:
111       apt:
112         sources:
113           sourceline:
114             - ppa:ubuntu-toolchain-r/test
115         packages:
116           - autopoint
117           - g++-9
118   - env: CONFIG=arm-cross DIST=xenial
119     os: linux
120     dist: xenial
121     compiler: gcc
122     addons:
123       apt:
124         packages:
125           - autopoint
126           - gcc-4.8-arm-linux-gnueabihf
127           - libc6-dev-armhf-cross
128   - env: CONFIG=musl DIST=xenial
129     os: linux
130     dist: xenial
131     compiler: gcc
132     addons:
133       apt:
134         packages:
135           - autopoint
136           - musl-tools
137   - env: CONFIG=sanitize DIST=xenial
138     os: linux
139     dist: xenial
140     compiler: clang
141     addons:
142       apt:
143         sources:
144           sourceline:
145             - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
146           key_url:
147             - https://apt.llvm.org/llvm-snapshot.gpg.key
148         packages:
149           - autopoint
150           - clang-10
151           - libtool
152     # Required for -fsanitize=undefined
153     # see https://github.com/travis-ci/travis-ci/issues/9033
154     sudo: required
155   - env: CONFIG=coverage DIST=xenial
156     os: linux
157     dist: xenial
158     compiler: gcc
159     addons:
160       apt:
161         packages:
162           - autopoint
163           - libpopt-dev
164           - subversion
165     cache:
166       directories:
167         - $HOME/failmalloc
168   - env: CONFIG=normal DIST=bionic
169     arch: arm64
170     os: linux
171     dist: bionic
172     compiler: gcc
173   - env: CONFIG=normal DIST=bionic
174     arch: ppc64le
175     os: linux
176     dist: bionic
177     compiler: gcc
178
179 before_install:
180   # The apt addons section is ignored on bionic for some reason
181   - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint gettext libtool; fi
182
183 install:
184   - |
185     if [ "$CONFIG" = "coverage" ] ; then
186       set -e
187       pip install --user cpp-coveralls
188       cd "$HOME"
189       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
190       cd libexif-testsuite
191       mkdir src
192       ln -s "$TRAVIS_BUILD_DIR" src/libexif
193       ./build-config.sh
194       autoreconf -sivf
195       cd "$HOME"
196       # Failmalloc for improved test coverage
197       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
198         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
199         tar xaf failmalloc-1.0.tar.gz
200         cd failmalloc-1.0
201         # Fix compiling with modern glibc
202         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
203         # Disable failmalloc on program exit so system code can run unimpeded
204         sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall);
205         }' failmalloc.c
206         ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
207         make
208         make install
209       fi
210       cd "$TRAVIS_BUILD_DIR"
211     fi
212
213 script:
214   # Ensure brew gettext is in the PATH so autopoint is found on OS X
215   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
216   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
217   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
218   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
219   - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
220   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
221   - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-8; fi
222   - if [ "$CONFIG" = "clang9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-9; fi
223   - if [ "$CONFIG" = "clang10" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-10; fi
224   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-8; fi
225   - if [ "$CONFIG" = "gcc9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-9; fi
226   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
227   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
228   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-10; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1; fi
229   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib"; fi
230   - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; }
231
232   - make V=1 $MAKE_OPTS
233   # Skip tests when cross compiling.
234   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 $MAKE_OPTS check || { tail -n 300 test*/test-suite.log src/libexif/test*/test-suite.log; false; }; fi
235   - make V=1 $MAKE_OPTS install
236
237   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
238
239 after_success:
240   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi