Skip to content

Commit 4394713

Browse files
authored
Use jlutilities mechanism for external package required in test (#60232)
1 parent 99936fe commit 4394713

File tree

8 files changed

+78
-24
lines changed

8 files changed

+78
-24
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Pkg
22

33
Pkg.activate(dirname(@__DIR__)) do
4-
Pkg.instantiate()
54
include("runtests.jl")
65
end

JuliaLowering/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
/Manifest.toml

JuliaLowering/Manifest.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.14.0-DEV"
4+
manifest_format = "2.1"
5+
project_hash = "16f6f8d58c46fe20d68a941bfaddb4590471548a"
6+
7+
[[deps.JuliaLowering]]
8+
deps = ["JuliaSyntax"]
9+
path = "."
10+
uuid = "f3c80556-a63f-4383-b822-37d64f81a311"
11+
version = "1.0.0-DEV"
12+
13+
[[deps.JuliaSyntax]]
14+
path = "../JuliaSyntax"
15+
uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4"
16+
version = "2.0.0-DEV"

JuliaLowering/test/runtests_vendored.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ try
33
# test local (dev) copy of JuliaLowering, not yet vendored into Base
44
Base.set_active_project(joinpath(@__DIR__, "..", "Project.toml"))
55
manifest_path = joinpath(@__DIR__, "..", "Manifest.toml")
6-
isfile(manifest_path) && rm(manifest_path)
7-
8-
# activate and instantiate JuliaSyntax as a local package (rather than using
9-
# Base.JuliaSyntax)
10-
import Pkg
11-
Pkg.instantiate()
126

137
# restore error hints (emptied by `testdefs.jl`) so that errors print as
148
# JuliaLowering expects them to
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.14.0-DEV"
4+
manifest_format = "2.1"
5+
project_hash = "23b8253b8eadb7ba5d7489bb56f38819b7150654"
6+
7+
[[deps.ObjectFile]]
8+
deps = ["Reexport", "StructIO"]
9+
git-tree-sha1 = "22faba70c22d2f03e60fbc61da99c4ebfc3eb9ba"
10+
registries = "General"
11+
uuid = "d8793406-e978-5875-9003-1fc021f44a92"
12+
version = "0.5.0"
13+
14+
[[deps.Reexport]]
15+
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
16+
registries = "General"
17+
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
18+
version = "1.2.2"
19+
20+
[[deps.StructIO]]
21+
git-tree-sha1 = "c581be48ae1cbf83e899b14c07a807e1787512cc"
22+
registries = "General"
23+
uuid = "53d494c1-5632-5724-8f4c-31dff12d585f"
24+
version = "0.3.1"
25+
26+
[registries.General]
27+
url = "https://github.com/JuliaRegistries/General.git"
28+
uuid = "23338594-aafe-5451-b93e-139f81909106"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
ObjectFile = "d8793406-e978-5875-9003-1fc021f44a92"

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ end
2828

2929
const rmwait_timeout = running_under_rr() ? 300 : 30
3030

31+
ENV["JULIA_TEST_BUILDROOT"] = buildroot
3132
if use_revise
3233
# First put this at the top of the DEPOT PATH to install revise if necessary.
3334
# Once it's loaded, we swizzle it to the end, to avoid confusing any tests.

test/stdlib_dependencies.jl

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

33
using Libdl
4-
using Pkg
54
using Test
6-
prev_env = Base.active_project()
7-
Pkg.activate(temp=true)
8-
Pkg.add(Pkg.PackageSpec(name="ObjectFile", uuid="d8793406-e978-5875-9003-1fc021f44a92", version="0.4"))
9-
using ObjectFile
10-
try
115

6+
# Load ObjectFile.jl from the vendored jlutilities depot
7+
buildroot = get(ENV, "JULIA_TEST_BUILDROOT", joinpath(@__DIR__, ".."))
8+
depspath = joinpath(buildroot, "deps", "jlutilities")
9+
if ispath(depspath)
10+
depspath = realpath(depspath)
11+
# With a source-tree use the vendored depot
12+
pushfirst!(DEPOT_PATH, joinpath(depspath, "depot"))
13+
using Pkg
14+
old_active_project = Base.active_project()
15+
Base.redirect_stdout(devnull) do
16+
Base.redirect_stderr(devnull) do
17+
Pkg.activate(realpath(joinpath(@__DIR__, "..", "deps", "jlutilities", "objectfile")))
18+
Pkg.instantiate()
19+
end
20+
end
21+
using ObjectFile
22+
popfirst!(DEPOT_PATH)
23+
Base.set_active_project(old_active_project)
24+
else
25+
# Without a source-tree - expect that the user has installed it for us - warn otherwise
26+
ObjectFile_pkgid = Base.PkgId(Base.UUID("d8793406-e978-5875-9003-1fc021f44a92"), "ObjectFile")
27+
if Base.locate_package(ObjectFile_pkgid) !== nothing
28+
@eval using ObjectFile
29+
end
30+
end
31+
32+
if !@isdefined(ObjectFile)
33+
@warn("ObjectFile.jl not available; skipping stdlib JLL dependency tests")
34+
else
1235
strip_soversion(lib::AbstractString) = Base.BinaryPlatforms.parse_dl_name_version(lib)[1]
1336

1437
function get_deps_objectfile_macos(lib_path::String)
@@ -249,8 +272,8 @@ try
249272

250273
# This is a manually-managed special case
251274
if stdlib_name == "libblastrampoline_jll" &&
252-
prop_name == :libblastrampoline &&
253-
extraneous_deps in (["libopenblas64_"], ["libopenblas"])
275+
prop_name == :libblastrampoline &&
276+
extraneous_deps in (["libopenblas64_"], ["libopenblas"])
254277
deps_mismatch = false
255278
end
256279

@@ -315,12 +338,4 @@ try
315338
end
316339
end
317340
end
318-
319-
finally
320-
if prev_env !== nothing
321-
Pkg.activate(prev_env)
322-
else
323-
# If no previous environment, activate the default one
324-
Pkg.activate()
325-
end
326341
end

0 commit comments

Comments
 (0)