Skip to content

Commit cbf0be6

Browse files
committed
Add JuliaLowering to TESTNAMES / make test
The environment when running under Distributed is slightly different than running via `Pkg.test()` so this required some tweaks to error printing, etc.
1 parent 9e69dab commit cbf0be6

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
old_active_project = Base.active_project()
2+
try
3+
# test local (dev) copy of JuliaLowering, not yet vendored into Base
4+
Base.set_active_project(joinpath(@__DIR__, "..", "Project.toml"))
5+
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()
12+
13+
# restore error hints (emptied by `testdefs.jl`) so that errors print as
14+
# JuliaLowering expects them to
15+
Base.Experimental.register_error_hint(Base.UndefVarError_hint, UndefVarError)
16+
17+
# n.b.: these must be run in `Main`, so that type-printing is equivalent
18+
# when running via Pkg.test() (e.g. "SyntaxGraph" should be printed instead
19+
# of "JuliaLowering.SyntaxGraph")
20+
@eval Main using JuliaLowering
21+
Core.include(Main, joinpath(@__DIR__, "runtests.jl")) # run the actual tests
22+
finally
23+
# Restore original load path and active project
24+
Base.set_active_project(old_active_project)
25+
end

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export JULIA_LOAD_PATH := @$(PATHSEP)@stdlib
1111
unexport JULIA_PROJECT :=
1212
unexport JULIA_BINDIR :=
1313

14-
TESTGROUPS = unicode strings compiler Compiler JuliaSyntax
14+
TESTGROUPS = unicode strings compiler Compiler JuliaSyntax JuliaLowering
1515
TESTS = all default stdlib $(TESTGROUPS) \
1616
$(patsubst $(STDLIBDIR)/%/,%,$(dir $(wildcard $(STDLIBDIR)/*/.))) \
1717
$(filter-out runtests testdefs relocatedepot, \

test/choosetests.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const TESTNAMES = [
3131
"smallarrayshrink", "opaque_closure", "filesystem", "download",
3232
"scopedvalues", "compileall", "rebinding",
3333
"faulty_constructor_method_should_not_cause_stack_overflows",
34-
"JuliaSyntax"
34+
"JuliaSyntax", "JuliaLowering",
3535
]
3636

3737
const INTERNET_REQUIRED_LIST = [
@@ -48,9 +48,9 @@ const INTERNET_REQUIRED_LIST = [
4848
const NETWORK_REQUIRED_LIST = vcat(INTERNET_REQUIRED_LIST, ["Sockets"])
4949

5050
const TOP_LEVEL_PKGS = [
51-
"Compiler"
52-
"JuliaSyntax"
53-
"JuliaLowering"
51+
"Compiler",
52+
"JuliaSyntax",
53+
"JuliaLowering",
5454
]
5555

5656
function test_path(test)
@@ -71,6 +71,9 @@ function test_path(test)
7171
elseif t[1] == "JuliaSyntax"
7272
testpath = length(t) >= 2 ? t[2:end] : ("runtests_vendored",)
7373
return joinpath(@__DIR__, "..", t[1], "test", testpath...)
74+
elseif t[1] == "JuliaLowering"
75+
testpath = length(t) >= 2 ? t[2:end] : ("runtests_vendored",)
76+
return joinpath(@__DIR__, "..", t[1], "test", testpath...)
7477
else
7578
return joinpath(@__DIR__, test)
7679
end

0 commit comments

Comments
 (0)