google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
34.53k stars 10.09k forks source link

Add sanitizers to GitHub Actions CI #4413

Closed bjosv closed 8 months ago

bjosv commented 10 months ago

Run all testcases with ASan, UBSan and TSan during Linux CI. A few testcases which are not suitable to run with a sanitizer are exempted in these runs, like for ExitedWithCode and AllowLeak.

This PR is a continuation of PR #3648 to be able find issues already in CI.

Introduces the following defines to indicate when built with a sanitizer, which can be used to disable sanitizers on testcase level:

and the following bazel test tags to disable on test binary level: no_asan, no_ubsan, no_tsan

dinord commented 10 months ago

We only ever accepted GitHub Actions as a best-effort community contribution, and do not maintain it ourselves. We use Google-internal tools (including sanitizers) on our end, and having e.g. defined(GTEST_HAS_ADDRESS_SANITIZER) does not work with our internal tools.

We'd consider accepting sanitizers in GitHub Actions if you can figure out a way to make them work without adding new #ifdefs in code, either by fixing actual bugs in code or reconfiguring the sanitizers so they don't trigger on false positives.

bjosv commented 8 months ago

Closing this since I cant find a way to config the sanitizer to handle ExitedWithCode and AllowLeak.