aboutsummaryrefslogtreecommitdiff
path: root/scripts/travis.sh
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-03-13 12:11:03 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-13 15:26:28 -0300
commitf6ace9962d95eb12236083871154c1501f02c556 (patch)
treef9a1d5b6ca8eaa68114c98dcd92c6161bc15454d /scripts/travis.sh
parent3cac32e49c7fae9cf5963d35f3fd3052c061b2fa (diff)
downloadrneovim-f6ace9962d95eb12236083871154c1501f02c556.tar.gz
rneovim-f6ace9962d95eb12236083871154c1501f02c556.tar.bz2
rneovim-f6ace9962d95eb12236083871154c1501f02c556.zip
Refactor travis build to use clang's sanitizers
- Valgrind configuration removed - Fix errors reported by the undefined behavior sanitizer - Travis will now run two build steps: - A normal build of a shared library for unit testing(in parallel with gcc) - A clang build with some sanitizers enabled for integration testing. After these changes travis will run much faster, while providing valgrind-like error detection.
Diffstat (limited to 'scripts/travis.sh')
-rwxr-xr-xscripts/travis.sh62
1 files changed, 45 insertions, 17 deletions
diff --git a/scripts/travis.sh b/scripts/travis.sh
index 7292953710..fb5a770863 100755
--- a/scripts/travis.sh
+++ b/scripts/travis.sh
@@ -1,21 +1,49 @@
#!/bin/sh -e
-export VALGRIND_CHECK=1
-export BUSTED_OUTPUT_TYPE="TAP"
-make cmake CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$PWD/dist"
-make
-make unittest
-echo "Running tests with valgrind..."
-if ! make test; then
- if ls src/testdir/valgrind.* > /dev/null 2>&1; then
- echo "Memory leak detected" >&2
- cat src/testdir/valgrind.*
- else
- echo "Failed tests:" >&2
- for t in src/testdir/*.failed; do
- echo ${t%%.*}
- done
+check_and_report() {
+ reset
+ (
+ cd $tmpdir
+ if [ -f asan.* ] || [ -f tsan.* ] || [ -f ubsan.* ]; then
+ cat $tmpdir/asan.* 2> /dev/null || true
+ cat $tmpdir/tsan.* 2> /dev/null || true
+ cat $tmpdir/ubsan.* 2> /dev/null || true
+ exit 1
fi
- exit 1
+ )
+}
+
+if [ "$CC" = "clang" ]; then
+ # force using the version installed by 'travis-setup.sh'
+ export CC=/usr/bin/clang
+
+ install_dir="$(pwd)/dist"
+ # temporary directory for writing sanitizer logs
+ tmpdir="$(pwd)/tmp"
+ rm -rf "$tmpdir"
+ mkdir -p "$tmpdir"
+
+ # need the symbolizer path for stack traces with source information
+ symbolizer=/usr/bin/llvm-symbolizer-3.4
+
+ export SKIP_UNITTEST=1
+ export SANITIZE=1
+ export ASAN_SYMBOLIZER_PATH=$symbolizer
+ export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
+ export TSAN_OPTIONS="external_symbolizer_path=$symbolizer:log_path=$tmpdir/tsan"
+ export UBSAN_OPTIONS="log_path=$tmpdir/ubsan" # not sure if this works
+
+ make cmake CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$install_dir"
+ make
+ if ! make test; then
+ check_and_report
+ fi
+ check_and_report
+ make install
+else
+ export BUSTED_OUTPUT_TYPE="TAP"
+ export SKIP_EXEC=1
+ make cmake
+ make unittest
fi
-make install
+