Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Sanitizer in Debug Build and Unit Tests #141

Closed
elfenpiff opened this issue Jun 15, 2020 · 4 comments · Fixed by #400
Closed

Enable Sanitizer in Debug Build and Unit Tests #141

elfenpiff opened this issue Jun 15, 2020 · 4 comments · Fixed by #400
Assignees
Labels
test A module/integration/stress/etc test for a component
Milestone

Comments

@elfenpiff
Copy link
Contributor

Brief feature description

Add the following compiler flags for the Linux (and MacOS build, if possible)
-fsanitize=address -fsanitze=undefined. All unit tests have to run without undefined behavior, memory leaks or other funky memory effects.

Detailed information

We can a avoid a wide variety of bugs when this is activated in the github CI.

@elfenpiff elfenpiff added the test A module/integration/stress/etc test for a component label Jun 15, 2020
@prasannabhat
Copy link
Contributor

Is this setting required only for CI build ?

@mossmaurice
Copy link
Contributor

Is this setting required only for CI build ?

Yeah, I would recommend to use the settings only for the CI.

@elfenpiff Opinions?

@SoftwareApe
Copy link

Don't forget you also need to scan the output for the different types of errors that asan and ubsan output. UBSan usually uses the normal gcc/clang warning format but saying "runtime error" instead of "warning" or "error.

ASan output looks a bit more like valgrind. You have the LeakSanitizer and AddressSanitizer failures to scan for.

@SoftwareApe
Copy link

SoftwareApe commented Jul 17, 2020

I would also suggest activating some additional ubsan flags:
-fsanitize=float-divide-by-zero:
Detect division by zero on floats. I would expect this to never happen on a safety critical project.

-fsanitize=float-cast-overflow:
Casting from float to integer can cause a lot of issues. With this option these problems become explicit.

@mossmaurice mossmaurice added this to the v1.x milestone Nov 4, 2020
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Nov 30, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Nov 30, 2020
…rrors

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Nov 30, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 2, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 2, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 7, 2020
- Separate compiler flags for lsan & asan
- Organise sanitizer blacklist files
- Support sanitizer for mac

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
…on.cmake

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
…clipse-iceoryx#141-enable-sanitizer

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
…tformn

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
…er branch

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
…tformn

Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
prasannabhat added a commit to prasannabhat/iceoryx that referenced this issue Dec 11, 2020
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
dkroenke added a commit that referenced this issue Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test A module/integration/stress/etc test for a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants