Debugging code generation when testing with package manager

I’m the developer of the package CpuId. I’m currently facing an issue which appears to only occur when testing the package through the package manager, viz. typing ]test CpuId. In that case, the core functions containing an llvmcall are somehow differently inlined and yield a segfault. This does not seem to occur in, say, regular operations. I have theories on why this happens, but I can’t reproduce the issue outside the package manager testing environment.

My question: How do I get a view on the generated code when testing through the package manager? (eg. @testset, @test etc.).
Thanks!

Not directly answering your question, but did you try to launch a Julia REPL with the same command line flags used in Pkg.jl?: https://github.com/JuliaLang/Pkg.jl/blob/853b3f1fd9895db32b402d89e9dee153b66b2316/src/Operations.jl#L1294-L1309

Also, since @test wraps code into a try block, it may help if you do so when generating the code.

2 Likes

Pkg.test just spawns a new Julia process and runs test/runtests.jl, so you should be able to reproduce everything that way.

1 Like

Thanks, @tkf and @Tamas_Papp. Found the additional option --check-bounds=yes for julia when using Pkg.test. These additional bounds checks are in fact triggering the segfaults.

1 Like