Avoiding recompilation between interactive use and testing by making testing also checkbounds=auto?

So because by default julia runs with check-bounds=auto,
but when testing it runs with check-bounds=yes
and those generate different package-images,
julia will have to re-precompile everything when you change from interactive use to ]test.
Even if you have no test time dependencies.
At least, that is my understanding.

Is there something i can monkey-patch to make testing also use check-bounds=auto ?
I can always leave it to CI for the final check anyway.

1 Like

Why not use check-bounds=yes in the REPL?


also an option.
is there an easy way to do that in my startup.jl?
i don’t want to deal with shell aliases.

Not exactly answering your question, but in case you didn’t know that (I discovered this only recently) you can run tests with --check-bounds=auto with

Pkg.test("MyPackage"; julia_args=`--check-bounds=auto`)
1 Like

Related to your question, I think you want to hack

1 Like

No, because global flags like that need to be set before julia starts. stattup.jl runs after the global flags like --check-bounds are set. The test suite does that by launching a worker process where the test code is run, if I recall correctly.

I have now been doing this since this comment, and it has been a huge enhancement to my life.
I recommend everyone who is developing a lot of julia packages do this.

1 Like

@oxinabox you mean starting julia by default with --check-bounds=yes?
Did you do it via a shell alias in the end?

1 Like

I do something complicated.
I have a bash script that starts my julia that I run from VS-Code because I want to run the VS-Code language server and the REPL using different versions of julia.
(I want my REPL running something near nightly)

and that script is like

#!/usr/bin/env bash
set -e
if [ -z "$JULIA_VSCODE_INTERNAL" ]; then
	exec julia-crimes --check-bounds=yes "$@"
	exec julia +release --check-bounds=yes "$@"

So it always passes the argument