fix CVE-2019-9278
[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=normal DIST=xenial
47     os: linux
48     dist: xenial
49     compiler: gcc
50   - env: CONFIG=normal DIST=xenial
51     os: linux
52     dist: xenial
53     compiler: clang
54   - env: CONFIG=clang6 DIST=xenial
55     os: linux
56     dist: xenial
57     compiler: clang
58     addons:
59       apt:
60         packages:
61           - autopoint
62           - clang-6.0
63   - env: CONFIG=clang8
64     os: linux
65     compiler: clang
66     addons:
67       apt:
68         sources:
69           - llvm-toolchain-trusty-8
70           - ubuntu-toolchain-r-test
71         packages:
72           - autopoint
73           - clang-8
74   - env: CONFIG=gcc8
75     os: linux
76     compiler: gcc
77     addons:
78       apt:
79         sources:
80           - ubuntu-toolchain-r-test
81         packages:
82           - autopoint
83           - g++-8
84   - env: CONFIG=arm-cross
85     os: linux
86     compiler: gcc
87     addons:
88       apt:
89         packages:
90           - autopoint
91           - gcc-4.8-arm-linux-gnueabihf
92           - libc6-dev-armhf-cross
93   - env: CONFIG=musl DIST=xenial
94     os: linux
95     dist: xenial
96     compiler: gcc
97     addons:
98       apt:
99         packages:
100           - autopoint
101           - musl-tools
102   - env: CONFIG=sanitize
103     os: linux
104     compiler: clang
105     addons:
106       apt:
107         sources:
108           - llvm-toolchain-trusty-8
109           - ubuntu-toolchain-r-test
110         packages:
111           - autopoint
112           - clang-8
113           - libtool
114     # Required for -fsanitize=undefined
115     # see https://github.com/travis-ci/travis-ci/issues/9033
116     sudo: required
117   - env: CONFIG=coverage DIST=xenial
118     os: linux
119     dist: xenial
120     compiler: gcc
121     addons:
122       apt:
123         packages:
124           - autopoint
125           - libpopt-dev
126           - subversion
127     cache:
128       directories:
129         - $HOME/failmalloc
130   - env: CONFIG=normal DIST=bionic
131     arch: arm64
132     os: linux
133     dist: bionic
134     compiler: gcc
135
136 before_install:
137   # The apt addons section is ignored on bionic for some reason
138   - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint gettext libtool; fi
139
140 install:
141   - |
142     if [ "$CONFIG" = "coverage" ] ; then
143       set -e
144       pip install --user cpp-coveralls
145       cd "$HOME"
146       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
147       cd libexif-testsuite
148       mkdir src
149       ln -s "$TRAVIS_BUILD_DIR" src/libexif
150       ./build-config.sh
151       autoreconf -sivf
152       cd "$HOME"
153       # Failmalloc for improved test coverage
154       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
155         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
156         tar xaf failmalloc-1.0.tar.gz
157         cd failmalloc-1.0
158         # Fix compiling with modern glibc
159         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
160         # Disable failmalloc on program exit so system code can run unimpeded
161         sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall);
162         }' failmalloc.c
163         ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
164         make
165         make install
166       fi
167       cd "$TRAVIS_BUILD_DIR"
168     fi
169
170 script:
171   # Ensure brew gettext is in the PATH so autopoint is found on OS X
172   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
173   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
174   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
175   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
176   - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
177   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
178   - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-8; fi
179   - 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
180   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
181   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
182   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-8; 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
183   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib"; fi
184   - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; }
185
186   - make V=1 $MAKE_OPTS
187   # Skip tests when cross compiling.
188   - 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
189   - make V=1 $MAKE_OPTS install
190
191   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
192
193 after_success:
194   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi