travis-ci enable tests under address sanitizier (#8095)

This commit is contained in:
Daniel Agar 2017-10-17 16:26:17 -04:00 committed by GitHub
parent c607805154
commit 979d092628
3 changed files with 43 additions and 18 deletions

View File

@ -7,6 +7,15 @@ git:
depth: 2000
submodules: false
env:
global:
# COVERITY KEY
- secure: "NyaJoCGjU0Xc90Y6bxVYWLgjrJX5HlZsm/SPxruZ6I7xkGo19fJIFzGegOHQFR32D4AiKjllfjTUNy+ncckWplind0QwxtF4/kxXrz9XBfiby6X8jLYXIekrB6Ay0mBLGbniDdh+lpWtcyop6Dmkt5bdJCJuKY2nv9ENnhhs07M="
# AWS KEY: $PX4_AWS_KEY
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
# AWS SECRET: $PX4_AWS_SECRET
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
matrix:
fast_finish: true
include:
@ -24,7 +33,12 @@ matrix:
sudo: required
services:
- docker
env: BUILD_TARGET=tests PX4_DOCKER_REPO=px4io/px4-dev-base:ubuntu17.10
env: BUILD_TARGET=tests_asan
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=tests_coverage
- os: linux
sudo: required
services:
@ -50,12 +64,8 @@ matrix:
sudo: required
env: BUILD_TARGET=coverity_scan
allow_failures:
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=tests_coverage
- env: BUILD_TARGET=tests_asan
- env: BUILD_TARGET=tests_coverage
cache:
ccache: true
@ -67,30 +77,32 @@ before_install:
fi
# use git:// to fetch instead of https://
- git config --global url."git://".insteadOf https://
env:
global:
# COVERITY KEY
- secure: "NyaJoCGjU0Xc90Y6bxVYWLgjrJX5HlZsm/SPxruZ6I7xkGo19fJIFzGegOHQFR32D4AiKjllfjTUNy+ncckWplind0QwxtF4/kxXrz9XBfiby6X8jLYXIekrB6Ay0mBLGbniDdh+lpWtcyop6Dmkt5bdJCJuKY2nv9ENnhhs07M="
# AWS KEY: $PX4_AWS_KEY
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
# AWS SECRET: $PX4_AWS_SECRET
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
script:
- if [[ "${BUILD_TARGET}" = "coverity_scan" ]]; then
echo "no script for coverity build";
elif [[ "${TRAVIS_BRANCH}" = "coverity" ]]; then
echo "exit early for coverity build" && exit 0;
elif [[ "${BUILD_TARGET}" = "check_format" ]]; then
./Tools/docker_run.sh 'make check_format';
elif [[ "${BUILD_TARGET}" = "tests" ]]; then
./Tools/docker_run.sh 'make tests';
elif [[ "${BUILD_TARGET}" = "tests_coverage" ]]; then
./Tools/docker_run.sh 'make tests_coverage' && bash <(curl -s https://codecov.io/bash) -F unittests;
elif [[ "${BUILD_TARGET}" = "tests_asan" ]]; then
./Tools/docker_run.sh 'PX4_ASAN=1 make tests';
elif [[ "${BUILD_TARGET}" = "px4_metadata" ]]; then
./Tools/docker_run.sh 'make px4_metadata';
elif [[ "${BUILD_TARGET}" = "clang-tidy" ]]; then
./Tools/docker_run.sh 'make clang-tidy-quiet';
fi
after_success:

View File

@ -108,10 +108,10 @@ else
endif
# additional config parameters passed to cmake
CMAKE_ARGS := -Wno-deprecated
CMAKE_ARGS += -Wno-deprecated
ifdef EXTERNAL_MODULES_LOCATION
CMAKE_ARGS := -DEXTERNAL_MODULES_LOCATION:STRING=$(EXTERNAL_MODULES_LOCATION)
CMAKE_ARGS += -DEXTERNAL_MODULES_LOCATION:STRING=$(EXTERNAL_MODULES_LOCATION)
endif
ifdef PX4_CMAKE_BUILD_TYPE
@ -296,7 +296,7 @@ format:
.PHONY: tests tests_coverage
tests:
$(MAKE) --no-print-directory posix_sitl_default test_results
$(MAKE) --no-print-directory posix_sitl_default test_results ASAN_OPTIONS="color=always"
tests_coverage:
@$(MAKE) --no-print-directory posix_sitl_default test_coverage_genhtml PX4_CMAKE_BUILD_TYPE=Coverage

View File

@ -36,6 +36,16 @@ option(SANITIZE_MEMORY "Enable MemorySanitizer" Off)
option(SANITIZE_THREAD "Enable ThreadSanitizer" Off)
option(SANITIZE_UNDEFINED "Enable UndefinedBehaviorSanitizer" Off)
if(DEFINED ENV{PX4_ASAN})
set(SANITIZE_ADDRESS ON)
elseif(DEFINED ENV{PX4_MSAN})
set(SANITIZE_MEMORY ON)
elseif(DEFINED ENV{PX4_TSAN})
set(SANITIZE_THREAD ON)
elseif(DEFINED ENV{PX4_UBSAN})
set(SANITIZE_UNDEFINED ON)
endif()
if (SANITIZE_ADDRESS)
message(STATUS "address sanitizer enabled")
@ -48,6 +58,7 @@ if (SANITIZE_ADDRESS)
-fsanitize=address
#-fsanitize-address-use-after-scope
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" CACHE INTERNAL "" FORCE)
elseif(SANITIZE_MEMORY)
message(STATUS "thread sanitizer enabled")
@ -64,6 +75,7 @@ elseif(SANITIZE_THREAD)
-g3
-fsanitize=thread
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" CACHE INTERNAL "" FORCE)
elseif(SANITIZE_UNDEFINED)
message(STATUS "undefined behaviour sanitizer enabled")
@ -90,5 +102,6 @@ elseif(SANITIZE_UNDEFINED)
-fsanitize=vla-bound
-fsanitize=vptr
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined" CACHE INTERNAL "" FORCE)
endif()