Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
fatteneder committed Oct 8, 2024
1 parent df8495f commit be62b89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/RelocationTestPkg1/src/RelocationTestPkg1.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module RelocationTestPkg1

const relocpath = Base.RelocPath(@__DIR__)

greet() = print("Hello World!")

end # module RelocationTestPkg1
11 changes: 9 additions & 2 deletions test/relocatedepot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function test_harness(@nospecialize(fn); empty_load_path=true, empty_depot_path=
end

# We test relocation with these dummy pkgs:
# - RelocationTestPkg1 - pkg with no include_dependency
# - RelocationTestPkg1 - pkg with no include_dependency, also contains a RelocPath()
# - RelocationTestPkg2 - pkg with include_dependency tracked by `mtime`
# - RelocationTestPkg3 - pkg with include_dependency tracked by content
# - RelocationTestPkg4 - pkg with no dependencies; will be compiled such that the pkgimage is
Expand Down Expand Up @@ -263,11 +263,18 @@ else
pkgname = "RelocationTestPkg1"
test_harness() do
push!(LOAD_PATH, joinpath(@__DIR__, "relocatedepot"))
push!(DEPOT_PATH, joinpath(@__DIR__, "relocatedepot")) # required to find src files
push!(DEPOT_PATH, joinpath(@__DIR__, "relocatedepot", "julia")) # contains cache file
push!(DEPOT_PATH, joinpath(@__DIR__, "relocatedepot")) # required to find src files
pkg = Base.identify_package(pkgname)
@test Base.isprecompiled(pkg) == true
@test Base.isrelocatable(pkg) == true
pkg = Base.require(pkg)
@test String(pkg.relocpath) == joinpath(pkgdir(pkg), "src")
pop!(DEPOT_PATH)
@test_throws(
ErrorException("Failed to relocate @depot/RelocationTestPkg1/src in any of DEPOT_PATH."),
String(pkg.relocpath)
)
end
end

Expand Down

0 comments on commit be62b89

Please sign in to comment.