Skip to content

Commit 0a9ac18

Browse files
committed
Turn of inlining when computing coverage
It can also be explicitly turned on or off via the new keyword argument `inline` for Pkg.test.
1 parent 05a7cb0 commit 0a9ac18

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/API.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ test(pkg::Union{String, PackageSpec}; kwargs...) = test([pkg]; kwargs...)
254254
test(pkgs::Vector{String}; kwargs...) = test([PackageSpec(pkg) for pkg in pkgs]; kwargs...)
255255
test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...)
256256

257-
function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...)
257+
function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, inline=nothing, kwargs...)
258258
pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
259259
Context!(ctx; kwargs...)
260260
ctx.preview && preview_info()
@@ -270,6 +270,10 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...
270270
if !ctx.preview && (Operations.any_package_not_installed(ctx) || !isfile(ctx.env.manifest_file))
271271
Pkg.instantiate(ctx)
272272
end
273+
if inline == nothing
274+
# by default, allow inline for normal tests, and forbid it for coverage tests
275+
inline = !coverage
276+
end
273277
Operations.test(ctx, pkgs; coverage=coverage)
274278
return
275279
end

src/Operations.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec})
12801280
need_to_resolve && build_versions(ctx, new)
12811281
end
12821282

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

0 commit comments

Comments
 (0)