summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--Makefile11
-rw-r--r--circle.yml141
3 files changed, 151 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0acc58004c..e0d60240cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,7 +68,7 @@ if(WITH_COVERAGE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
endif(WITH_COVERAGE)
-set(CMAKE_CONFIGURATION_TYPES Debug Release)
+set(CMAKE_CONFIGURATION_TYPES Debug Release Sanitize)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -ftemplate-depth=1024 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Werror -Wno-variadic-macros -Wno-unknown-pragmas")
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
@@ -76,6 +76,7 @@ if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-command-line-argument")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG")
+set(CMAKE_CXX_FLAGS_SANITIZE "-O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls")
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
diff --git a/Makefile b/Makefile
index 46fbb9f464..b6e4b608fa 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,10 @@ export BUILDTYPE ?= Debug
export WITH_CXX11ABI ?= $(shell scripts/check-cxx11abi.sh)
ifeq ($(BUILDTYPE), Release)
+else ifeq ($(BUILDTYPE), Sanitize)
else ifeq ($(BUILDTYPE), Debug)
else
- $(error BUILDTYPE must be Debug or Release)
+ $(error BUILDTYPE must be Debug, Sanitize or Release)
endif
buildtype := $(shell echo "$(BUILDTYPE)" | tr "[A-Z]" "[a-z]")
@@ -297,8 +298,12 @@ benchmark: $(LINUX_BUILD)
$(NINJA) $(NINJA_ARGS) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-benchmark
ifneq (,$(shell command -v gdb 2> /dev/null))
- GDB = $(shell scripts/mason.sh PREFIX gdb VERSION 2017-04-08-aebcde5)/bin/gdb \
- -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args
+ GDB ?= $(shell scripts/mason.sh PREFIX gdb VERSION 2017-04-08-aebcde5)/bin/gdb \
+ -batch -return-child-result \
+ -ex 'set print thread-events off' \
+ -ex 'set disable-randomization off' \
+ -ex 'run' \
+ -ex 'thread apply all bt' --args
endif
.PHONY: run-test
diff --git a/circle.yml b/circle.yml
index 58e08cfc4f..99e9be5a9d 100644
--- a/circle.yml
+++ b/circle.yml
@@ -11,6 +11,9 @@ workflows:
- node6-clang39-release
- node6-clang39-debug
- linux-clang39-debug
+ - linux-clang4-sanitize-address
+ - linux-clang4-sanitize-undefined
+ - linux-clang4-sanitize-thread
- linux-gcc4.9-debug
- linux-gcc5-debug-coverage
- linux-gcc5-release-qt4
@@ -332,6 +335,144 @@ jobs:
- node_modules
- /root/.ccache
+
+# ------------------------------------------------------------------------------
+ linux-clang4-sanitize-address:
+ docker:
+ - image: mbgl/ci:r4-linux-clang-4
+ working_directory: /src
+ environment:
+ LIBSYSCONFCPUS: 6
+ JOBS: 6
+ BUILDTYPE: Sanitize
+ WITH_EGL: 1
+ GDB: '' # Do not run with GDB
+ CXXFLAGS: -fsanitize=address
+ LDFLAGS: -fsanitize=address
+ ASAN_OPTIONS: detect_leaks=0:color=always
+ steps:
+ - checkout
+ - restore_cache:
+ key: v1-linux-clang4-sanitize-address
+ paths:
+ - node_modules
+ - /root/.ccache
+ - run:
+ name: Environment Setup
+ command: |
+ # LLVM has a hard check for "llvm-symbolizer" and doesn't support suffixed executables
+ ln -s /usr/bin/llvm-symbolizer-* /usr/bin/llvm-symbolizer
+ # We'll use tee to redirect stderr to a file so we can check for sanitiziation
+ # https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1059947
+ sed -i 's/"$@" 2>&1/"$@"/' /usr/bin/xvfb-run
+ - run:
+ name: Build test
+ command: make test
+ - run:
+ name: Run tests
+ command: |
+ xvfb-run --server-args="-screen 0 1024x768x24" make run-test 2> >(tee sanitizer 1>&2)
+ # Unfortunately, Google Test eats the status code, so we'll have to check the output.
+ [ -z "$(sed -n '/^SUMMARY: AddressSanitizer:/p' sanitizer)" ]
+ - save_cache:
+ key: v1-linux-clang4-sanitize-address
+ paths:
+ - node_modules
+ - /root/.ccache
+
+
+# ------------------------------------------------------------------------------
+ linux-clang4-sanitize-undefined:
+ docker:
+ - image: mbgl/ci:r4-linux-clang-4
+ working_directory: /src
+ environment:
+ LIBSYSCONFCPUS: 6
+ JOBS: 6
+ BUILDTYPE: Sanitize
+ WITH_EGL: 1
+ GDB: '' # Do not run with GDB
+ CXXFLAGS: -fsanitize=undefined
+ LDFLAGS: -fsanitize=undefined
+ UBSAN_OPTIONS: print_stacktrace=1:color=always
+ steps:
+ - checkout
+ - restore_cache:
+ key: v1-linux-clang4-sanitize-undefined
+ paths:
+ - node_modules
+ - /root/.ccache
+ - run:
+ name: Environment Setup
+ command: |
+ # LLVM has a hard check for "llvm-symbolizer" and doesn't support suffixed executables
+ ln -s /usr/bin/llvm-symbolizer-* /usr/bin/llvm-symbolizer
+ # We'll use tee to redirect stderr to a file so we can check for sanitiziation
+ # https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1059947
+ sed -i 's/"$@" 2>&1/"$@"/' /usr/bin/xvfb-run
+ - run:
+ name: Build test
+ command: make test
+ - run:
+ name: Run tests
+ command: |
+ xvfb-run --server-args="-screen 0 1024x768x24" make run-test 2> >(tee sanitizer 1>&2)
+ # Unfortunately, Google Test eats the status code, so we'll have to check the output.
+ # Uncomment this once we've fixed all thread behavior to make new thread behavior
+ # fail on CircleCI.
+ # [ -z "$(sed -n '/^SUMMARY: UndefinedBehaviorSanitizer:/p' sanitizer)" ]
+ - save_cache:
+ key: v1-linux-clang4-sanitize-address-undefined
+ paths:
+ - node_modules
+ - /root/.ccache
+
+
+# ------------------------------------------------------------------------------
+ linux-clang4-sanitize-thread:
+ docker:
+ - image: mbgl/ci:r4-linux-clang-4
+ working_directory: /src
+ environment:
+ LIBSYSCONFCPUS: 6
+ JOBS: 6
+ BUILDTYPE: Sanitize
+ WITH_EGL: 1
+ GDB: '' # Do not run with GDB
+ CXXFLAGS: -fsanitize=thread
+ LDFLAGS: -fsanitize=thread
+ TSAN_OPTIONS: color=always
+ steps:
+ - checkout
+ - restore_cache:
+ key: v1-linux-clang4-sanitize-thread
+ paths:
+ - node_modules
+ - /root/.ccache
+ - run:
+ name: Environment Setup
+ command: |
+ # LLVM has a hard check for "llvm-symbolizer" and doesn't support suffixed executables
+ ln -s /usr/bin/llvm-symbolizer-* /usr/bin/llvm-symbolizer
+ # We'll use tee to redirect stderr to a file so we can check for sanitiziation
+ # https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1059947
+ sed -i 's/"$@" 2>&1/"$@"/' /usr/bin/xvfb-run
+ - run:
+ name: Build test
+ command: make test
+ - run:
+ name: Run tests
+ command: |
+ xvfb-run --server-args="-screen 0 1024x768x24" make run-test 2> >(tee sanitizer 1>&2)
+ # Unfortunately, Google Test eats the status code, so we'll have to check the output.
+ [ -z "$(sed -n '/^SUMMARY: ThreadSanitizer:/p' sanitizer)" ]
+ - save_cache:
+ key: v1-linux-clang4-sanitize-thread
+ paths:
+ - node_modules
+ - /root/.ccache
+
+
# ------------------------------------------------------------------------------
linux-gcc4.9-debug:
docker: