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

Fix build flags for tests #903

Closed
wants to merge 0 commits into from
Closed

Conversation

busterb
Copy link
Contributor

@busterb busterb commented Aug 27, 2023

The default C flags for all build types other than 'Debug' sets -DNDEBUG which disables assert(), and breaks tests. This switches tests to use 'Debug' instead, reenabling asserts.

@botovq
Copy link
Contributor

botovq commented Aug 27, 2023 via email

@botovq
Copy link
Contributor

botovq commented Aug 27, 2023 via email

@busterb
Copy link
Contributor Author

busterb commented Aug 27, 2023

This is targeted just a tests, so it shouldn't affect the speed of the underlying library being linked for the tests.

You'd think that remove_definitions would work, but it doesn't work in reality. remove_definitions("-DNDEBUG") seems to have no effect anywhere that I tried it. Open to suggestions in case I missed something! Maybe I just couldn't figure out the appropriate place, but tried in the base CMakeLists.txt, the one for tests, in various places.

I noticed we're using a mixture of OPENSSL_assert and assert in the libraries. If an assert is security-critical and should not be optimized out, shouldn't it be using a mechanism that is unconditional?

@botovq
Copy link
Contributor

botovq commented Aug 27, 2023 via email

@busterb
Copy link
Contributor Author

busterb commented Aug 28, 2023

I think this should do it. Not 100% sure if the MSVC conditional is necessary on all systems, but easier to write it this way for now.

@botovq
Copy link
Contributor

botovq commented Aug 28, 2023 via email

@busterb
Copy link
Contributor Author

busterb commented Aug 29, 2023

FYI, I merged these changes with rebase, which made it look weird here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants