Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
587c2e24
Commit
587c2e24
authored
6 years ago
by
Lukas Woodtli
Committed by
Daniel Agar
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve the use of ubsan in SITL pipeline
Also some general minor sanitizer improvements.
parent
9530b6c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.ci/Jenkinsfile-SITL_tests
+1
-0
1 addition, 0 deletions
.ci/Jenkinsfile-SITL_tests
cmake/common/sanitizers.cmake
+16
-15
16 additions, 15 deletions
cmake/common/sanitizers.cmake
with
17 additions
and
15 deletions
.ci/Jenkinsfile-SITL_tests
+
1
−
0
View file @
587c2e24
...
...
@@ -193,6 +193,7 @@ pipeline {
}
//stages
environment
{
ASAN_OPTIONS
=
'detect_stack_use_after_return=1:check_initialization_order=1'
UBSAN_OPTIONS
=
'print_stacktrace=1'
CCACHE_DIR
=
'/tmp/ccache'
CI
=
true
CTEST_OUTPUT_ON_FAILURE
=
1
...
...
This diff is collapsed.
Click to expand it.
cmake/common/sanitizers.cmake
+
16
−
15
View file @
587c2e24
...
...
@@ -46,6 +46,7 @@ if (CMAKE_BUILD_TYPE STREQUAL AddressSanitizer)
-fno-common
# Do not treat global variable in C as common variables (allows ASan to instrument them)
-fno-optimize-sibling-calls
# disable inlining and and tail call elimination for perfect stack traces
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-fsanitize=address"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-fsanitize=address"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_MODULE_LINKER_FLAGS
"
${
CMAKE_MODULE_LINKER_FLAGS
}
-fsanitize=address"
CACHE INTERNAL
""
FORCE
)
...
...
@@ -56,7 +57,11 @@ if (CMAKE_BUILD_TYPE STREQUAL AddressSanitizer)
endfunction
(
sanitizer_fail_test_on_error
)
elseif
(
CMAKE_BUILD_TYPE STREQUAL MemorySanitizer
)
message
(
STATUS
"MemorySanitizer enabled"
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
message
(
WARNING
"MemorySanitizer might not be available with gcc"
)
else
()
message
(
STATUS
"MemorySanitizer enabled"
)
endif
()
add_compile_options
(
-O1
...
...
@@ -71,9 +76,11 @@ elseif (CMAKE_BUILD_TYPE STREQUAL MemorySanitizer)
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-fsanitize=memory"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-fsanitize=memory"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_MODULE_LINKER_FLAGS
"
${
CMAKE_MODULE_LINKER_FLAGS
}
-fsanitize=memory"
CACHE INTERNAL
""
FORCE
)
function
(
sanitizer_fail_test_on_error test_name
)
# TODO add right check here
set_tests_properties
(
${
test_name
}
PROPERTIES FAIL_REGULAR_EXPRESSION
"WARNING: MemorySanitizer"
)
endfunction
(
sanitizer_fail_test_on_error
)
elseif
(
CMAKE_BUILD_TYPE STREQUAL ThreadSanitizer
)
...
...
@@ -85,9 +92,11 @@ elseif (CMAKE_BUILD_TYPE STREQUAL ThreadSanitizer)
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-fsanitize=thread"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-fsanitize=thread"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_MODULE_LINKER_FLAGS
"
${
CMAKE_MODULE_LINKER_FLAGS
}
-fsanitize=thread"
CACHE INTERNAL
""
FORCE
)
function
(
sanitizer_fail_test_on_error test_name
)
# TODO add right check here
set_tests_properties
(
${
test_name
}
PROPERTIES FAIL_REGULAR_EXPRESSION
"WARNING: ThreadSanitizer"
)
endfunction
(
sanitizer_fail_test_on_error
)
elseif
(
CMAKE_BUILD_TYPE STREQUAL UndefinedBehaviorSanitizer
)
...
...
@@ -95,39 +104,31 @@ elseif (CMAKE_BUILD_TYPE STREQUAL UndefinedBehaviorSanitizer)
add_compile_options
(
-g3
#-fsanitize=alignment
-fsanitize=alignment
-fsanitize=bool
#-fsanitize=builtin
-fsanitize=bounds
-fsanitize=enum
-fsanitize=float-cast-overflow
-fsanitize=float-divide-by-zero
#-fsanitize=function
-fsanitize=integer-divide-by-zero
-fsanitize=nonnull-attribute
-fsanitize=null
#-fsanitize=nullability-arg
#-fsanitize=nullability-assign
#-fsanitize=nullability-return
-fsanitize=object-size
#-fsanitize=pointer-overflow
-fsanitize=return
-fsanitize=returns-nonnull-attribute
-fsanitize=shift
-fsanitize=signed-integer-overflow
-fsanitize=unreachable
#-fsanitize=unsigned-integer-overflow
-fsanitize=vla-bound
-fsanitize=vptr
-fno-sanitize-recover=bounds,null
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-fsanitize=undefined"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-fsanitize=undefined"
CACHE INTERNAL
""
FORCE
)
set
(
CMAKE_MODULE_LINKER_FLAGS
"
${
CMAKE_MODULE_LINKER_FLAGS
}
-fsanitize=undefined"
CACHE INTERNAL
""
FORCE
)
function
(
sanitizer_fail_test_on_error test_name
)
# TODO add right check here
set_tests_properties
(
${
test_name
}
PROPERTIES FAIL_REGULAR_EXPRESSION
"runtime error:"
)
endfunction
(
sanitizer_fail_test_on_error
)
else
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment