Skip to content

Commit

Permalink
add test for JuliaLang#52161
Browse files Browse the repository at this point in the history
  • Loading branch information
fatteneder committed Jan 6, 2024
1 parent 5e8ea59 commit eba00a2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/relocatedepot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,41 @@ if !test_relocated_depot
end
end

@testset "#52161" begin
# Take the src file from the precompiled RelocationTestPkg1, which is located in depot1, and
# add it as an include_dependency() to a new pkg Foo, which will be precompiled into depot2.
# Foo should be fully relocatable and the include_dependency() should refer to depot1.
pkgname = "Foo"
test_harness() do
# make RelocationTestPkg1 loadable
depot1 = @__DIR__
push!(LOAD_PATH, depot1)
push!(DEPOT_PATH, depot1)
# precompile Foo into another depot
mktempdir() do depot2
pushfirst!(LOAD_PATH, depot2)
pushfirst!(DEPOT_PATH, depot2)
foofile = joinpath(depot2, "Foo.jl")
write(foofile, """
module Foo
using RelocationTestPkg1
srcfile = joinpath(pkgdir(RelocationTestPkg1), "src", "RelocationTestPkg1.jl")
@show srcfile
include_dependency(srcfile)
end
""")
pkg = Base.identify_package(pkgname)
Base.require(pkg)
cachefile = joinpath(depot2, "compiled", "v1.11", "Foo.ji")
_, (deps, _, _), _... = Base.parse_cache_header(cachefile)
@test map(x -> x.filename, deps) ==
[ joinpath(depot2, "Foo.jl"),
joinpath(depot1, "RelocationTestPkg1", "src", "RelocationTestPkg1.jl") ]
end
end
end


else

@testset "load stdlib from test/relocatedepot" begin
Expand Down

0 comments on commit eba00a2

Please sign in to comment.