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

simplify JET #176

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,12 @@ using Test
using QuantumOpticsBase
using JET

using JET: ReportPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport

# Custom report pass that ignores `UncaughtExceptionReport`
# Too coarse currently, but it serves to ignore the various
# "may throw" messages for runtime errors we raise on purpose
# (mostly on malformed user input)
struct MayThrowIsOk <: ReportPass end

# ignores `UncaughtExceptionReport` analyzed by `JETAnalyzer`
(::MayThrowIsOk)(::Type{UncaughtExceptionReport}, @nospecialize(_...)) = return

# forward to `BasicPass` for everything else
function (::MayThrowIsOk)(report_type::Type{<:InferenceErrorReport}, @nospecialize(args...))
BasicPass()(report_type, args...)
end

# imported to be declared as modules filtered out from analysis result
using LinearAlgebra, LRUCache, Strided, StridedViews, Dates, SparseArrays, RandomMatrices

@testset "jet" begin
if get(ENV,"JET_TEST","")=="true"
rep = report_package("QuantumOpticsBase";
report_pass=MayThrowIsOk(), # TODO have something more fine grained than a generic "do not care about thrown errors"
ignored_modules=( # TODO fix issues with these modules or report them upstream
AnyFrameModule(LinearAlgebra),
AnyFrameModule(LRUCache),
Expand All @@ -35,7 +18,7 @@ using LinearAlgebra, LRUCache, Strided, StridedViews, Dates, SparseArrays, Rando
AnyFrameModule(RandomMatrices))
)
@show rep
@test length(JET.get_reports(rep)) <= 29
@test length(JET.get_reports(rep)) <= 24
@test_broken length(JET.get_reports(rep)) == 0
end
end # testset
Loading