Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ language: c

cache:
- pip
- ccache

addons:
apt:
packages:
- shellcheck
- valgrind
- gcc
- clang
- python-docutils
- python3-pip
- python3-setuptools
- ninja-build
- meson
- python3-pytest
- libglib2.0-dev
- ccache

install: test/travis-install.sh

Expand All @@ -27,5 +27,17 @@ jobs:
- name: Lint
script: ./test/lint.sh
install: skip
- name: Build + Test
- name: Build + Test (clang)
compiler: clang
script: test/travis-build.sh
- name: Build + Test (gcc)
compiler: gcc
script: test/travis-build.sh
- name: Build with sanitizer (undefined)
compiler: clang
env: SANITIZER=undefined
script: test/travis-build.sh
- name: Build with sanitizer (address)
compiler: clang
env: SANITIZER=address
script: test/travis-build.sh
7 changes: 7 additions & 0 deletions test/build_test_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

CC=gcc test/travis-build.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: make this work with a relative path

CC=clang test/travis-build.sh
CC=clang SANITIZER=undefined test/travis-build.sh
CC=clang SANITIZER=address test/travis-build.sh
56 changes: 24 additions & 32 deletions test/travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,31 @@ set -e
export ASAN_OPTIONS="detect_leaks=0"

export LSAN_OPTIONS="suppressions=${PWD}/test/lsan_suppress.txt"
export CC

TEST_CMD="python3 -m pytest --maxfail=99 test/"

build_opts='-D werror=true'

if [ -n "$SANITIZER" ]; then
build_type=$SANITIZER
build_opts="${build_opts} -D b_sanitize=${SANITIZER}"
else
build_type=$CC
export TEST_WITH_VALGRIND=true
fi

# b_lundef=false is required to work around clang
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
if [[ "${CC}" == 'gcc-6' || "${CC}" =~ "clang" ]]; then
build_opts="${build_opts} -D b_lundef=false"
fi

# Standard build with Valgrind
for CC in gcc clang; do
(
mkdir "build-${CC}"; cd "build-${CC}"
if [ "${CC}" == 'gcc-6' ]; then
build_opts='-D b_lundef=false'
else
build_opts=''
fi
# shellcheck disable=SC2086
meson -D werror=true ${build_opts} ../
ninja

TEST_WITH_VALGRIND=true ${TEST_CMD}
)
done
(cd "build-${CC}"; sudo ninja install)

# Sanitized build
CC=clang
for san in undefined address; do
(
mkdir "build-${san}"
cd "build-${san}"
# b_lundef=false is required to work around clang
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true ..
ninja
${TEST_CMD}
sudo ninja install
)
done
mkdir "build-${build_type}"
cd "build-${build_type}"
#shellcheck disable=SC2086
meson ${build_opts} ..
ninja

${TEST_CMD}
sudo ninja install