Skip to content

Commit

Permalink
Test address sanitizer in a separate build
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas authored and rolandwalker committed May 21, 2018
1 parent 4f563bb commit a75ea46
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 20 deletions.
18 changes: 10 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: c

# LeakSanitizer requires ptrace capabilities
# https://github.com/travis-ci/travis-ci/issues/9033
sudo: required
sudo: false

addons:
apt:
Expand All @@ -12,10 +9,8 @@ addons:
- valgrind

env:
global:
matrix:
- TRAVIS_TIG=autoconf
- TRAVIS_TIG=config
- TIG_BUILD=autoconf
- TIG_BUILD=config.make

compiler:
- gcc
Expand All @@ -25,6 +20,13 @@ script: tools/travis.sh

matrix:
include:
- env: TIG_BUILD=address-sanitizer
compiler: clang
os: linux
# LeakSanitizer requires ptrace capabilities
# https://github.com/travis-ci/travis-ci/issues/9033
sudo: required
script: tools/travis.sh
- if: branch = master
os: osx
env:
Expand Down
39 changes: 27 additions & 12 deletions tools/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,50 @@
set -euo pipefail
IFS=$'\n\t'

build_config () {
build_config_make() {
cp contrib/config.make .
make all-debug
make update-docs && git diff --exit-code
make test
make test TEST_OPTS=valgrind
if [ $CC = clang ]; then make test-address-sanitizer; fi
make DESTDIR=/tmp/bare-destdir install install-doc
make DESTDIR=/tmp/bare-destdir uninstall
test ! -d /tmp/bare-destdir

make prefix=/tmp/bare-prefix install install-doc
/tmp/bare-prefix/bin/tig --version
make prefix=/tmp/bare-prefix uninstall
test ! -d /tmp/bare-prefix

make distclean
}

build_autoconf () {
build_autoconf() {
make dist
./configure --prefix=/tmp/conf-prefix
make V=1 TEST_SHELL=bash all test install install-doc
make V=1 TEST_SHELL=bash all test

make install install-doc
/tmp/conf-prefix/bin/tig --version
make uninstall
test ! -d /tmp/conf-prefix

make DESTDIR=/tmp/bare-destdir install install-doc
/tmp/bare-destdir/tmp/conf-prefix/bin/tig --version
make DESTDIR=/tmp/bare-destdir uninstall
test ! -d /tmp/bare-destdir

make clean
}

if [[ $TRAVIS_TIG = config ]]; then
build_config
elif [[ $TRAVIS_TIG = autoconf ]]; then
build_autoconf
fi
build_address_sanitizer() {
cp contrib/config.make .
make test-address-sanitizer
}

case "$TIG_BUILD" in
config.make) build_config_make ;;
autoconf) build_autoconf ;;
address-sanitizer) build_address_sanitizer ;;

*)
echo "Unknown config: $TIG_BUILD"
exit 1
esac

0 comments on commit a75ea46

Please sign in to comment.