Browse Source

cmake and Jenkins add basic address santiizer test buld

master
Daniel Agar 7 years ago
parent
commit
3639087ac6
  1. 19
      CMakeLists.txt
  2. 2
      EKF/tests/base/base.cpp
  3. 18
      Jenkinsfile
  4. 5
      Makefile

19
CMakeLists.txt

@ -57,6 +57,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -57,6 +57,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# code coverage support
option(COV_HTML "Display html for coverage" OFF)
option(ECL_ASAN "Enable ECL address sanitizer" OFF)
set(CMAKE_CXX_FLAGS_COVERAGE
"--coverage -fprofile-arcs -ftest-coverage -fno-default-inline -fno-inline -fno-inline-small-functions -fno-elide-constructors"
@ -137,6 +138,24 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) @@ -137,6 +138,24 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
endif()
# santiziers (ASAN)
if(ECL_ASAN)
message(STATUS "ecl address sanitizer enabled ")
# environment variables
# ASAN_OPTIONS=detect_stack_use_after_return=1
# ASAN_OPTIONS=check_initialization_order=1
add_compile_options(
-fsanitize=address
-g3
-O1
-fno-omit-frame-pointer
)
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address)
endif()
add_subdirectory(airdata)
add_subdirectory(attitude_fw)
add_subdirectory(EKF)

2
EKF/tests/base/base.cpp

@ -143,5 +143,7 @@ int main(int argc, char *argv[]) @@ -143,5 +143,7 @@ int main(int argc, char *argv[])
//base->printStoredMag();
//base->printStoredGps();
delete base;
return 0;
}

18
Jenkinsfile vendored

@ -137,6 +137,24 @@ pipeline { @@ -137,6 +137,24 @@ pipeline {
}
}
stage('test (asan)') {
agent {
docker {
image 'px4io/px4-dev-ecl:2018-04-22'
args '-v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'ccache -z'
sh 'make distclean'
sh 'make test_asan'
sh 'ccache -s'
sh 'make distclean'
}
}
stage('doxygen') {
agent {
docker {

5
Makefile

@ -109,6 +109,11 @@ test_EKF: test_build @@ -109,6 +109,11 @@ test_EKF: test_build
test_EKF_plots: test_build
@cmake --build $(SRC_DIR)/build/test_build --target ecl_EKF_pytest-plots
test_build_asan:
@$(call cmake-build,$@,$(SRC_DIR), "-DECL_ASAN=ON")
test_asan: test_build_asan
@cmake --build $(SRC_DIR)/build/test_build_asan --target check
# Code coverage
# --------------------------------------------------------------------

Loading…
Cancel
Save