Skip to content

Commit

Permalink
Test modifications for nightly (1.10)
Browse files Browse the repository at this point in the history
1.10 makes substantial changes in invalidation-reporting.
  • Loading branch information
timholy committed Mar 18, 2023
1 parent 55aec36 commit 83c504b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/snoopi_deep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ end
@test :build_stale stalenames
@test :use_stale stalenames
trees = invalidation_trees(invalidations)
tree = trees[findfirst(tree -> !isempty(tree.backedges), trees)]
tree = length(trees) == 1 ? only(trees) : trees[findfirst(tree -> !isempty(tree.backedges), trees)]
@test tree.method == which(StaleA.stale, (String,)) # defined in StaleC
@test all(be -> Core.MethodInstance(be).def == which(StaleA.stale, (Any,)), tree.backedges)
if Base.VERSION > v"1.8.0-DEV.368"
Expand Down
45 changes: 29 additions & 16 deletions test/snoopr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ end
# These next are identical to the above
@test methinvs.method == m
@test methinvs.reason === :inserting
root = only(methinvs.backedges)
@test root.mi == mi3
@test SnoopCompile.getroot(root) === root
@test root.depth == 0
child = only(root.children)
@test child.mi == mi1
@test SnoopCompile.getroot(child) === root
@test child.depth == 1
if isempty(child.children)
have_backedges = !isempty(methinvs.backedges)
if have_backedges
root = only(methinvs.backedges)
@test root.mi == mi3
@test SnoopCompile.getroot(root) === root
@test root.depth == 0
child = only(root.children)
@test child.mi == mi1
@test SnoopCompile.getroot(child) === root
@test child.depth == 1
end
if isempty(methinvs.backedges) || isempty(child.children)
# the mt_backedges got invalidated first
sig, root = only(methinvs.mt_backedges)
@test sig === Tuple{typeof(Main.SnooprTests.f), Any}
Expand All @@ -132,8 +135,13 @@ end
print(io, methinvs)
str = String(take!(io))
@test startswith(str, "inserting f(::Float32)")
@test occursin("backedges: 1: superseding f(::AbstractFloat)", str)
@test occursin("with MethodInstance for $(prefix)f(::AbstractFloat) ($targetdepth children)", str)
if !isempty(methinvs.backedges)
@test occursin("backedges: 1: superseding f(::AbstractFloat)", str)
@test occursin("with MethodInstance for $(prefix)f(::AbstractFloat) ($targetdepth children)", str)
else
@test occursin("signature Tuple{typeof($(prefix)f), Any} triggered", str)
@test occursin("for $(prefix)applyf(::Vector{Any}) ($targetdepth children)", str)
end

show(io, root; minchildren=1)
str = String(take!(io))
Expand All @@ -153,10 +161,15 @@ end
"MethodInstance for $(prefix)applyf(::$(Vector{Any})) (1 children)")
@test lines[2] == ""

ftrees = filtermod(@__MODULE__, trees)
ftree = only(ftrees)
@test ftree.backedges == methinvs.backedges
@test isempty(ftree.mt_backedges)
if have_backedges
ftrees = filtermod(@__MODULE__, trees)
ftree = only(ftrees)
@test ftree.backedges == methinvs.backedges
@test isempty(ftree.mt_backedges)
else
ftrees = filtermod(SnooprTests, trees)
@test ftrees == trees
end

cai = Any[1]
cas = Any[:sym]
Expand Down Expand Up @@ -201,7 +214,7 @@ end
@test occursin("Invalidations %", str)

trees = invalidation_trees(invs)
@test length(trees) == 3
@test length(trees) >= 3
io = IOBuffer()
show(io, trees)
str = String(take!(io))
Expand Down

0 comments on commit 83c504b

Please sign in to comment.