Skip to content

Commit

Permalink
Make relocatedepot test more robust (JuliaLang#53110)
Browse files Browse the repository at this point in the history
As discussed in the `#ci-dev` call (see
JuliaLang#53103 (comment)
and
JuliaLang#53104 (comment))
there were two problems:

* the use of `Base.require` caused the package to be loaded
* the name of the package was a generic placeholder, and clashed with
other packages loaded during the tests called with the same generic
name.

The solution was to rename test module with a more specific name, and
replace `Base.require` with `Base.compilecache`, the latter only
compiles the package without loading it.

Should fix JuliaLang#53103, close JuliaLang#53104.
  • Loading branch information
giordano committed Jan 30, 2024
1 parent 9816a0b commit 75c38e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/relocatedepot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ if !test_relocated_depot
Base.require(pkg)
mktempdir() do depot3
# precompile Foo in depot3
open(joinpath(depot3, "Foo.jl"), write=true) do io
open(joinpath(depot3, "Module52161.jl"), write=true) do io
println(io, """
module Foo
module Module52161
using Example1
using Example2
srcfile1 = joinpath(pkgdir(Example1), "src", "Example1.jl")
Expand All @@ -159,13 +159,13 @@ if !test_relocated_depot
end
pushfirst!(LOAD_PATH, depot3)
pushfirst!(DEPOT_PATH, depot3)
pkg = Base.identify_package("Foo")
Base.require(pkg)
pkg = Base.identify_package("Module52161")
Base.compilecache(pkg)
cachefile = joinpath(depot3, "compiled",
"v$(VERSION.major).$(VERSION.minor)", "Foo.ji")
"v$(VERSION.major).$(VERSION.minor)", "Module52161.ji")
_, (deps, _, _), _... = Base.parse_cache_header(cachefile)
@test map(x -> x.filename, deps) ==
[ joinpath(depot3, "Foo.jl"),
[ joinpath(depot3, "Module52161.jl"),
joinpath(depot1, "Example1", "src", "Example1.jl"),
joinpath(depot2, "Example2", "src", "Example2.jl") ]
end
Expand Down

0 comments on commit 75c38e3

Please sign in to comment.