mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 12:47:35 +08:00
cmake and Jenkins add basic address santiizer test buld
This commit is contained in:
@@ -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)
|
||||
|
||||
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)
|
||||
|
||||
@@ -143,5 +143,7 @@ int main(int argc, char *argv[])
|
||||
//base->printStoredMag();
|
||||
//base->printStoredGps();
|
||||
|
||||
delete base;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vendored
+18
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user