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

Should tests be run with julia --check-bounds=yes? #3747

Closed
ali-ramadhan opened this issue Aug 29, 2024 · 2 comments
Closed

Should tests be run with julia --check-bounds=yes? #3747

ali-ramadhan opened this issue Aug 29, 2024 · 2 comments
Labels
testing 🧪 Tests get priority in case of emergency evacuation

Comments

@ali-ramadhan
Copy link
Member

The codebase makes extensive use of @inbounds, for good reason and usually pretty safely. But does it make sense to run the tests with --check-bounds=yes to catch any cases of out-of-bounds memory accesses?

Out of bounds accesses don't always produce an error and can silently lead to undefined behavior.

This may lead to slightly slower tests, although I doubt it would slow them down by much as most of the time is spend on compiling.

Might help with discovering certain issues sooner. Probably #3615 but maybe not #3320.

X-Ref: #3682 (comment)

@ali-ramadhan ali-ramadhan added the testing 🧪 Tests get priority in case of emergency evacuation label Aug 29, 2024
@simone-silvestri
Copy link
Collaborator

simone-silvestri commented Aug 29, 2024

The tests should run with --check-bounds=yes automatically. I think that when calling Pkg.test() the testing environment automatically activates the 0 optimization flag (-O0) and the bounds checking flag --check-bounds=yes, but I cannot find a reference at the moment.

@ali-ramadhan
Copy link
Member Author

Ah you're right! I forgot that Pkg.test() did that. I found the docs for it: https://pkgdocs.julialang.org/v1/api/#Pkg.test

I think the -O0 flag is something Oceananigans.jl does on Buildkite though: https://github.com/CliMA/Oceananigans.jl/blob/main/.buildkite/pipeline.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing 🧪 Tests get priority in case of emergency evacuation
Projects
None yet
Development

No branches or pull requests

2 participants