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

Allow control of --bounds-check in Pkg.test #2668

Conversation

IanButterworth
Copy link
Member

Forcing bounds checking to be on can severely slow down some test code, so it would be useful to be able to allow bounds checking to be the julia default automatic that observes in-code declarations (set here via check_bounds = nothing which omits the --check-bounds option entirely).

There may be some use cases where forcing it off entirely may be desired too (check_bounds = false), so all three are supported

@DilumAluthge
Copy link
Member

Instead of adding another keyword argument to the Pkg.test function, could we do either of the following:

  1. Just read the value of --bounds-check that was passed to the original (parent) Julia process.
  2. Allow the user to pass --bounds-check to the julia_args keyword argument that we already have.

@IanButterworth
Copy link
Member Author

IanButterworth commented Jul 11, 2021

Just read the value of --bounds-check that was passed to the original (parent) Julia process.

This would be a significant (breaking?) change, as the parent process is likely run by default with --check-bounds omitted, i.e. default checking that observes code declarations, not forced on like Pkg.test currently does

Allow the user to pass --bounds-check to the julia_args keyword argument that we already have.

Users can currently do this, but it's not possible to set it to the default, as that requires omitting --check-bounds entirely.

If Base was changed to accept --check-bounds=auto then the latter could work

@DilumAluthge
Copy link
Member

If Base was changed to accept --check-bounds=auto then the latter could work

Regardless of what we end up doing in this PR, I do think it would be nice for Julia to accept --check-bounds=auto.

@IanButterworth
Copy link
Member Author

Yeah and it would be nice to get that into 1.7

@fredrikekre
Copy link
Member

Closing in favor of JuliaLang/julia#41551 then? In any case, if you need special behavior like this you can always start your own process from within the test/runtests.jl file. Many packages do that already for thigns like this.

@KristofferC
Copy link
Member

Users can currently do this, but it's not possible to set it to the default, as that requires omitting --check-bounds entirely.

I don't understand why this is not possible. In case you want it as the default you just omit it in julia_args?

@IanButterworth
Copy link
Member Author

By default I mean julia default, which respects @inbounds, which is a third state that requires omitting --check-bohnds entirely.

you can always start your own process from within the test/runtests.jl file

Yes but that makes managing test dependencies a pain, as there's no convenient way to merge a test Project and the parent in the same way that the sandbox does it, AFAIK

@fredrikekre
Copy link
Member

Yes but that makes managing test dependencies a pain, as there's no convenient way to merge a test Project and the parent in the same way that the sandbox does it, AFAIK

You just launch julia with the env Pkg gave test/runtests.jl

@KristofferC
Copy link
Member

By default I mean julia default, which respects @inbounds, which is a third state that requires omitting --check-bohnds entirely.

I understand that. But again, why isn't julia_args fine here, and just leave out the argument if you want the julia default?

@IanButterworth
Copy link
Member Author

just leave out the argument if you want the julia default?

% julia --check-bounds
ERROR: option `--check-bounds` is missing an argument
% julia --project --check-bounds=
ERROR: julia: invalid argument to --check-bounds={yes|no} ()

or am I misunderstanding your suggestion?

You just launch julia with the env Pkg gave test/runtests.jl

The env Pkg gave test/runtests.jl is a merge of the two envs in a temp dir sandbox. How would I access that? or do you just mean launch with --project in /test?

@KristofferC
Copy link
Member

or am I misunderstanding your suggestion?

Yes, I think so. Just don't add the whole --check-bounds bit at all.

@IanButterworth
Copy link
Member Author

Are you factoring in that it's currently hardcoded before julia_args in the sandbox?

--check-bounds=yes

@KristofferC
Copy link
Member

KristofferC commented Jul 12, 2021

No, that would make it harder indeed 😆. Having an auto flag like in the Julia PR then seems like probably the best?

@IanButterworth
Copy link
Member Author

Yeah. I'm happy for that PR to be the one

@IanButterworth IanButterworth deleted the ib/test_bounds_check_control branch July 12, 2021 12:58
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.

4 participants