Skip to content

Commit 83c504b

Browse files
committedMar 18, 2023
Test modifications for nightly (1.10)
1.10 makes substantial changes in invalidation-reporting.
1 parent 55aec36 commit 83c504b

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed
 

‎test/snoopi_deep.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ end
879879
@test :build_stale stalenames
880880
@test :use_stale stalenames
881881
trees = invalidation_trees(invalidations)
882-
tree = trees[findfirst(tree -> !isempty(tree.backedges), trees)]
882+
tree = length(trees) == 1 ? only(trees) : trees[findfirst(tree -> !isempty(tree.backedges), trees)]
883883
@test tree.method == which(StaleA.stale, (String,)) # defined in StaleC
884884
@test all(be -> Core.MethodInstance(be).def == which(StaleA.stale, (Any,)), tree.backedges)
885885
if Base.VERSION > v"1.8.0-DEV.368"

‎test/snoopr.jl

+29-16
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,18 @@ end
102102
# These next are identical to the above
103103
@test methinvs.method == m
104104
@test methinvs.reason === :inserting
105-
root = only(methinvs.backedges)
106-
@test root.mi == mi3
107-
@test SnoopCompile.getroot(root) === root
108-
@test root.depth == 0
109-
child = only(root.children)
110-
@test child.mi == mi1
111-
@test SnoopCompile.getroot(child) === root
112-
@test child.depth == 1
113-
if isempty(child.children)
105+
have_backedges = !isempty(methinvs.backedges)
106+
if have_backedges
107+
root = only(methinvs.backedges)
108+
@test root.mi == mi3
109+
@test SnoopCompile.getroot(root) === root
110+
@test root.depth == 0
111+
child = only(root.children)
112+
@test child.mi == mi1
113+
@test SnoopCompile.getroot(child) === root
114+
@test child.depth == 1
115+
end
116+
if isempty(methinvs.backedges) || isempty(child.children)
114117
# the mt_backedges got invalidated first
115118
sig, root = only(methinvs.mt_backedges)
116119
@test sig === Tuple{typeof(Main.SnooprTests.f), Any}
@@ -132,8 +135,13 @@ end
132135
print(io, methinvs)
133136
str = String(take!(io))
134137
@test startswith(str, "inserting f(::Float32)")
135-
@test occursin("backedges: 1: superseding f(::AbstractFloat)", str)
136-
@test occursin("with MethodInstance for $(prefix)f(::AbstractFloat) ($targetdepth children)", str)
138+
if !isempty(methinvs.backedges)
139+
@test occursin("backedges: 1: superseding f(::AbstractFloat)", str)
140+
@test occursin("with MethodInstance for $(prefix)f(::AbstractFloat) ($targetdepth children)", str)
141+
else
142+
@test occursin("signature Tuple{typeof($(prefix)f), Any} triggered", str)
143+
@test occursin("for $(prefix)applyf(::Vector{Any}) ($targetdepth children)", str)
144+
end
137145

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

156-
ftrees = filtermod(@__MODULE__, trees)
157-
ftree = only(ftrees)
158-
@test ftree.backedges == methinvs.backedges
159-
@test isempty(ftree.mt_backedges)
164+
if have_backedges
165+
ftrees = filtermod(@__MODULE__, trees)
166+
ftree = only(ftrees)
167+
@test ftree.backedges == methinvs.backedges
168+
@test isempty(ftree.mt_backedges)
169+
else
170+
ftrees = filtermod(SnooprTests, trees)
171+
@test ftrees == trees
172+
end
160173

161174
cai = Any[1]
162175
cas = Any[:sym]
@@ -201,7 +214,7 @@ end
201214
@test occursin("Invalidations %", str)
202215

203216
trees = invalidation_trees(invs)
204-
@test length(trees) == 3
217+
@test length(trees) >= 3
205218
io = IOBuffer()
206219
show(io, trees)
207220
str = String(take!(io))

0 commit comments

Comments
 (0)
Please sign in to comment.