aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/travis-setup.sh19
-rwxr-xr-xscripts/travis.sh62
2 files changed, 64 insertions, 17 deletions
diff --git a/scripts/travis-setup.sh b/scripts/travis-setup.sh
new file mode 100755
index 0000000000..437659dd77
--- /dev/null
+++ b/scripts/travis-setup.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+# [ "$CC" != "clang" ] && exit
+
+add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
+wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
+
+cat > /etc/apt/sources.list.d/clang.list << "EOF"
+deb http://llvm.org/apt/precise/ llvm-toolchain-precise main
+deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise main
+# 3.4
+deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main
+deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main
+# Common
+deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
+EOF
+
+apt-get -qq update
+apt-get -qq -y --no-install-recommends install clang-3.4 lldb-3.4
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
+