-
Notifications
You must be signed in to change notification settings - Fork 36
fix coverage test on nightly #498
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #498 +/- ##
==========================================
+ Coverage 86.13% 86.73% +0.60%
==========================================
Files 12 12
Lines 2394 2488 +94
==========================================
+ Hits 2062 2158 +96
+ Misses 332 330 -2
Continue to review full report at Codecov.
|
I wonder how the resolver error on 1.0 started happening. |
That's my fault. I added DiffUtils as a test dependency to make future debugging easier, but forgot that it requires Julia >= 1.3 |
08ac425
to
701a99e
Compare
test/limits.jl
Outdated
@test Aborted(frame, 1).at.file == Symbol("util.jl") | ||
elseif isdefined(Base, :Experimental) && | ||
isdefined(Base.Experimental, Symbol("@force_compile")) | ||
@test Aborted(frame, 1).at.file == Symbol("timing.jl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, that's unfortunate. I don't immediately understand why it's different from the old heuristic, but I haven't poked at it. Can you file a Julia issue? I regard line-number issues as bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really bug? The line numbers appearing in lowered code seems just identical:
v1.7
julia> ex = Main, Base.parse_input_line("""
x = 1
for i = 1:10
x += 1
end
let y = 0
z = 5
end
if 2 > 1
println("Hello, world!")
end
@elapsed sum(rand(5))
"""; filename="fake.jl"); Meta.lower(Main, ex)
:($(Expr(:toplevel, :(#= fake.jl:1 =#), :(x = 1), :(#= fake.jl:2 =#), :(for i = 1:10
#= fake.jl:3 =#
x += 1
end), :(#= fake.jl:5 =#), :(let y = 0
#= fake.jl:6 =#
z = 5
end), :(#= fake.jl:8 =#), :(if 2 > 1
#= fake.jl:9 =#
println("Hello, world!")
end), :(#= fake.jl:11 =#), :($(Expr(Symbol("hygienic-scope"), quote
#= timing.jl:297 =#
while false
#= timing.jl:297 =#
end
#= timing.jl:298 =#
local t0 = time_ns()
#= timing.jl:299 =#
$(Expr(:escape, :(sum(rand(5)))))
#= timing.jl:300 =#
(time_ns() - t0) / 1.0e9
end, Base))))))
nightly
julia> ex = Base.parse_input_line("""
x = 1
for i = 1:10
x += 1
end
let y = 0
z = 5
end
if 2 > 1
println("Hello, world!")
end
@elapsed sum(rand(5))
"""; filename="fake.jl"); Meta.lower(Main, ex)
:($(Expr(:toplevel, :(#= fake.jl:1 =#), :(x = 1), :(#= fake.jl:2 =#), :(for i = 1:10
#= fake.jl:3 =#
x += 1
#= fake.jl:4 =#
end), :(#= fake.jl:5 =#), :(let y = 0
#= fake.jl:6 =#
z = 5
end), :(#= fake.jl:8 =#), :(if 2 > 1
#= fake.jl:9 =#
println("Hello, world!")
end), :(#= fake.jl:11 =#), :($(Expr(Symbol("hygienic-scope"), quote
#= timing.jl:356 =#
$(Expr(Symbol("hygienic-scope"), :($(Expr(:meta, :force_compile))), Base.Experimental))
#= timing.jl:357 =#
local t0 = time_ns()
#= timing.jl:358 =#
$(Expr(:escape, :(sum(rand(5)))))
#= timing.jl:359 =#
(time_ns() - t0) / 1.0e9
end, Base))))))
The actual difference seems to be that v1.7 produces NewvarNode
while nightly doesn't:
v1.7
julia> modexs = collect(ExprSplitter(Main, ex)); frame = Frame(modexs[5]...); frame.framecode.src
CodeInfo(
@ fake.jl:11 within `top-level scope`
1 ─ Core.NewvarNode(:(#310#t0))
┌ @ timing.jl:297 within `macro expansion`
2 ┄│ goto #4 if not false
3 ─│ goto #2
└
┌ @ timing.jl:298 within `macro expansion`
4 ─│ _J1 = ($(QuoteNode(time_ns)))()
│ └
│ ┌ @ timing.jl:299 within `macro expansion`
│ │ rand(5)
│ │ sum(%J5)
│ └
│ ┌ @ timing.jl:300 within `macro expansion`
│ │ ($(QuoteNode(time_ns)))()
│ │ ($(QuoteNode(-)))(%J7, _J1)
│ │ ($(QuoteNode(/)))(%J8, 1.0e9)
│ └
└── return %J9
)
nightly
julia> modexs = collect(ExprSplitter(Main, ex)); frame = Frame(modexs[5]...); frame.framecode.src
CodeInfo(
@ fake.jl:11 within `top-level scope`
┌ @ timing.jl:356 within `macro expansion`
1 ─│ $(Expr(:meta, :force_compile))
│ │ @ timing.jl:357 within `macro expansion`
│ │ _J1 = ($(QuoteNode(time_ns)))()
│ │ @ timing.jl:358 within `macro expansion`
│ │ rand(5)
│ │ sum(%J3)
│ │ @ timing.jl:359 within `macro expansion`
│ │ ($(QuoteNode(time_ns)))()
│ │ ($(QuoteNode(-)))(%J5, _J1)
│ │ ($(QuoteNode(/)))(%J6, 1.0e9)
│ └
└── return %J7
)
So I'd say the first line number of that chunk was fake.jl
sort of accidentally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xref #500
isdefined(Base.Experimental, Symbol("@force_compile")) | ||
Base.Experimental.@force_compile | ||
end | ||
a = (VecElement{Float64}(1.0), VecElement{Float64}(2.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sure you need this? It didn't fail for me on nightly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I couldn't reproduce the error within REPL, but I also confirmed Pkg.test
will hit this line consistently without this change (maybe because the compilation heuristic used during Pkg.test
is different from that within REPL?).
I think the root problem here is that @interpret
doesn't configure enter_generated
when calling enter_call_expr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this if it's necessary.
I think one of the failures should be fixed by #500 instead, but otherwise I'm good with this. |
Sorry for the rebase. Once that's done let's merge this. |
Depends on JuliaLang/julia#42810 to pass. I did also observe some other test failures I couldn't really explain.
701a99e
to
2231cda
Compare
Depends on JuliaLang/julia#42810 to pass. I did also observe some other
test failures on nightly I couldn't really explain.