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

Behavior changes when flag --code-coverage=true is used in 1.0.3 #30872

Closed
tkoolen opened this issue Jan 28, 2019 · 9 comments
Closed

Behavior changes when flag --code-coverage=true is used in 1.0.3 #30872

tkoolen opened this issue Jan 28, 2019 · 9 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@tkoolen
Copy link
Contributor

tkoolen commented Jan 28, 2019

I found in tkoolen/PlanarConvexHulls.jl#1 that running tests with code coverage on resulted in a test failure that was not present when code coverage is off. This seems to have been fixed in 1.1.0.

I've tried to reduce the example a bit in the PR branch (to a single 94 line file: https://github.com/tkoolen/PlanarConvexHulls.jl/blob/821015de83c223accb9fd93fd98c4c5a4a65212f/test/runtests.jl), but it's a bit finicky. Removing or adding statements can cause tests to pass. Unfortunately, it still uses StaticArrays and LinearAlgebra, as my attempt to remove either one caused the example no longer reproduce the behavior. Similarly, adding an @show statement here: https://github.com/tkoolen/PlanarConvexHulls.jl/blob/821015de83c223accb9fd93fd98c4c5a4a65212f/test/runtests.jl#L36 resulted in different behavior.

To reproduce, add https://github.com/tkoolen/PlanarConvexHulls.jl.git#tk/debug-travis, run

using Pkg; Pkg.test("PlanarConvexHulls", coverage=true)

and compare to coverage=false.

tkoolen added a commit to tkoolen/PlanarConvexHulls.jl that referenced this issue Jan 28, 2019
@KristofferC
Copy link
Member

KristofferC commented Jan 28, 2019

Bounds check elision can change the results.

@tkoolen
Copy link
Contributor Author

tkoolen commented Jan 28, 2019

Testing locally, that didn't matter.

@KristofferC
Copy link
Member

How did you test locally? Did you recompile the package with the different flag?

@tkoolen
Copy link
Contributor Author

tkoolen commented Feb 14, 2019

First, whether you run

Pkg.test("PlanarConvexHulls", coverage=true)

or

Pkg.test("PlanarConvexHulls", coverage=false)

tests will be run in a new process with check-bounds=yes, so as I understand it that can't be the cause for the difference in behavior.

For more evidence, you can dev the package and just include("runtests.jl") after starting the REPL with --check-bounds={yes|no} and --code-coverage={none|user|all}, which shows that --code-coverage={user|all} results in different behavior than --code-coverage=none, regardless of the value of the --check-bounds.

@mdashti
Copy link

mdashti commented Jun 14, 2019

We also have a similar issue in our private repository at RelationalAI, but couldn't create a small snippet to reproduce the issue, yet.

@KristofferC
Copy link
Member

So to be clear, this has not really anything to do with Pkg but difference in behavior in running code depending on the --code-coverage setting? In that case, perhaps we can update the issue title.

@mdashti
Copy link

mdashti commented Jun 14, 2019

@KristofferC Yeah, that's correct. At least in our case, just running Julia with julia --code-coverage=user reproduces the issue.

An update on the issue on our side, it's solved after we've removed an explicit type declaration on a local variable, which is storing the value returned by tryparse(::Type{Float64}, ::WeakRefString), e.g.:

parsed_val::Union{Nothing, Float64} = tryparse(Float64, my_weak_ref_string_var)

to

parsed_val = tryparse(Float64, my_weak_ref_string_var)

@KristofferC KristofferC changed the title Difference between Pkg.test(coverage=true) and Pkg.test(coverage=false) on 1.0.3 Behavior changes when flag --code-coverage=true is used Jun 14, 2019
@KristofferC KristofferC added the bug Indicates an unexpected problem or unintended behavior label Jun 14, 2019
@tkoolen
Copy link
Contributor Author

tkoolen commented Jun 18, 2019

I just ran into this again in a different package (see referenced PR above).

@tkoolen tkoolen changed the title Behavior changes when flag --code-coverage=true is used Behavior changes when flag --code-coverage=true is used in 1.0.3 Jul 17, 2019
@vtjnash vtjnash closed this as completed Mar 15, 2020
@vtjnash
Copy link
Member

vtjnash commented Mar 15, 2020

Apparently fixed already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants