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