Skip to content

Commit

Permalink
Turn of inlining when computing coverage
Browse files Browse the repository at this point in the history
It can also be explicitly turned on or off via the new keyword argument
`inline` for Pkg.test.
  • Loading branch information
fingolfin committed Oct 30, 2018
1 parent 05a7cb0 commit 0a9ac18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ test(pkg::Union{String, PackageSpec}; kwargs...) = test([pkg]; kwargs...)
test(pkgs::Vector{String}; kwargs...) = test([PackageSpec(pkg) for pkg in pkgs]; kwargs...)
test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...)

function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...)
function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, inline=nothing, kwargs...)
pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
Context!(ctx; kwargs...)
ctx.preview && preview_info()
Expand All @@ -270,6 +270,10 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...
if !ctx.preview && (Operations.any_package_not_installed(ctx) || !isfile(ctx.env.manifest_file))
Pkg.instantiate(ctx)
end
if inline == nothing
# by default, allow inline for normal tests, and forbid it for coverage tests
inline = !coverage
end
Operations.test(ctx, pkgs; coverage=coverage)
return
end
Expand Down
3 changes: 2 additions & 1 deletion src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec})
need_to_resolve && build_versions(ctx, new)
end

function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false)
function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, inline=true)
# See if we can find the test files for all packages
missing_runtests = String[]
testfiles = String[]
Expand Down Expand Up @@ -1333,6 +1333,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false)
--color=$(Base.have_color ? "yes" : "no")
--compiled-modules=$(Bool(Base.JLOptions().use_compiled_modules) ? "yes" : "no")
--check-bounds=yes
--inline=$(inline ? "yes" : "no")
--startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no")
--track-allocation=$(("none", "user", "all")[Base.JLOptions().malloc_log + 1])
--eval $code
Expand Down

0 comments on commit 0a9ac18

Please sign in to comment.