With this module in a package:
module JetDebug
greet() = Base.blah()
end # module JetDebug
JET finds the problem when run in the REPL:
julia> using JET
julia> import JetDebug
julia> report_package(JetDebug)
[toplevel-info] virtualized the context of Main (took 0.022 sec)
[toplevel-info] entered into /home/james/git/scratch/JetDebug/src/JetDebug.jl
[toplevel-info] exited from /home/james/git/scratch/JetDebug/src/JetDebug.jl (took 0.142 sec)
[toplevel-info] analyzing from top-level definitions (1/1)
[toplevel-info] analyzed 1 top-level definitions (took 2.595 sec)
[ Info: tracking Base
═════ 1 possible error found ═════
┌ greet() @ JetDebug /home/james/git/scratch/JetDebug/src/JetDebug.jl:3
│┌ getproperty(x::Module, f::Symbol) @ Base ./Base.jl:42
││ `Base.blah` is not defined: Base.getglobal(x::Module, f::Symbol)
│└────────────────────
But with this in my runtests.jl
:
using JET
using JetDebug
report_package(JetDebug)
It does not find the problem:
Precompiling project for configuration --code-coverage=none --color=yes --check-bounds=yes --warn-overwrite=yes --depwarn=yes --inline=yes --startup-file=no --track-allocation=none...
✓ JetDebug
1 dependency successfully precompiled in 1 seconds. 33 already precompiled.
1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version
Testing Running tests...
[toplevel-info] virtualized the context of Main (took 0.026 sec)
[toplevel-info] entered into /home/james/git/scratch/JetDebug/src/JetDebug.jl
[toplevel-info] exited from /home/james/git/scratch/JetDebug/src/JetDebug.jl (took 0.164 sec)
[toplevel-info] analyzing from top-level definitions (1/1)
[toplevel-info] analyzed 1 top-level definitions (took 3.472 sec)
Testing JetDebug tests passed
Why is that? :thinking: I see that when run from the REPL it tracks Base
, which might have something to do with it. But I don't know why it wouldn't track base when run in the tests.
Ok, it also fails to find this problem when run in the tests:
module JetDebug
greet() = blah()
end # module JetDebug
So I guess the Base
tracking is a red herring.
I think the explanation is that report_package
returns a value that is displayed by the REPL, but when you run
report_package
in the tests, this value is not automatically displayed.
You could inspect the returned value to get something similar to the behaviour in the REPL: https://gitlab.com/stemann/julia-gitlab-ci-templates/-/blob/v1.5.0/templates.gitlab-ci.yaml#L185-192
Thanks, yes I actually made an issue about and it turns out I was dumb :upside_down: https://github.com/aviatesk/JET.jl/issues/646
test_package()
is the one I need.
Last updated: Dec 28 2024 at 04:38 UTC