Skip to content

Commit

Permalink
Merge pull request #27 from JuliaComputing/ct/ignore_throw_by_default
Browse files Browse the repository at this point in the history
Make `ignore_throw=true` the default
  • Loading branch information
topolarity authored Oct 30, 2023
2 parents d21c712 + d247e55 commit fbb888b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/AllocCheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ AllocCheck.AllocInstance[]
```
"""
function check_allocs(@nospecialize(func), @nospecialize(types); entry_abi=:specfunc, ret_mod=false, ignore_throw=false)
function check_allocs(@nospecialize(func), @nospecialize(types); entry_abi=:specfunc, ret_mod=false, ignore_throw=true)
job = create_job(func, types; entry_abi)
allocs = AllocInstance[]
mod = JuliaContext() do ctx
Expand Down
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ function same_ccall()
end

@testset "AllocCheck.jl" begin
@test length(check_allocs(mod, (Float64,Float64))) == 0
@test length(check_allocs(mod, (Float64,Float64); ignore_throw=false)) == 0
@test length(check_allocs(sin, (Float64,); ignore_throw=false)) > 0
@test length(check_allocs(sin, (Float64,); ignore_throw=true)) == 0
@test length(check_allocs(*, (Matrix{Float64},Matrix{Float64}))) != 0
@test length(check_allocs(*, (Matrix{Float64},Matrix{Float64}); ignore_throw=true)) != 0

@test length(check_allocs(alloc_in_catch, (); ignore_throw=false)) == 2
@test length(check_allocs(alloc_in_catch, (); ignore_throw=true)) == 1

@test length(check_allocs(same_ccall, (), ignore_throw=false)) == 2
@test length(check_allocs(same_ccall, (), ignore_throw=true)) == 2
@test length(check_allocs(same_ccall, (); ignore_throw=false)) == 2
@test length(check_allocs(same_ccall, (); ignore_throw=true)) == 2

@test length(check_allocs(first, (Core.SimpleVector,); ignore_throw = false)) == 3
@test length(check_allocs(first, (Core.SimpleVector,); ignore_throw = true)) == 0
@test length(check_allocs(time, ())) == 0
@test length(check_allocs(first, (Core.SimpleVector,); ignore_throw=false)) == 3
@test length(check_allocs(first, (Core.SimpleVector,); ignore_throw=true)) == 0
@test length(check_allocs(time, (); ignore_throw=false)) == 0
end

0 comments on commit fbb888b

Please sign in to comment.