Skip to content

Commit

Permalink
Precompile tests: Include name in depot path.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jan 13, 2025
1 parent 339330c commit 799fb14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
14 changes: 6 additions & 8 deletions test/helpers/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
function precompile_test_harness(@nospecialize(f), testset::String)
@testset "$testset" begin
precompile_test_harness(f, true)
end
end
function precompile_test_harness(@nospecialize(f), separate::Bool)
load_path = mktempdir()
load_cache_path = separate ? mktempdir() : load_path
function precompile_test_harness(@nospecialize(f), name::String, separate::Bool=true)
# XXX: adding the name because `mktempdir` is not deterministic under `Random.seed!(1)`
load_path = joinpath(mktempdir(), name)
load_cache_path = separate ? joinpath(mktempdir(), name) : load_path
mkpath(load_path)
mkpath(load_cache_path)
try
pushfirst!(LOAD_PATH, load_path)
pushfirst!(DEPOT_PATH, load_cache_path)
Expand Down
4 changes: 1 addition & 3 deletions test/native/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


precompile_test_harness("Inference caching") do load_path
precompile_test_harness("Native") do load_path
# Write out the Native test setup as a micro package
create_standalone(load_path, "TestCompiler", "native.jl")

Expand Down
2 changes: 1 addition & 1 deletion test/ptx/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
precompile_test_harness("Inference caching") do load_path
precompile_test_harness("PTX") do load_path
# Write out the PTX test helpers as a micro package
create_standalone(load_path, "TestCompiler", "ptx.jl")

Expand Down

0 comments on commit 799fb14

Please sign in to comment.