Skip to content

Commit d081c65

Browse files
committed
add unit test
1 parent be58fca commit d081c65

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

test/Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ STDLIBDIR := $(build_datarootdir)/julia/stdlib/$(VERSDIR)
99
TESTGROUPS = unicode strings compiler
1010
TESTS = all default stdlib $(TESTGROUPS) \
1111
$(patsubst $(STDLIBDIR)/%/,%,$(dir $(wildcard $(STDLIBDIR)/*/.))) \
12-
$(filter-out runtests testdefs, \
12+
$(filter-out runtests testdefs relocatedepot, \
1313
$(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/*.jl))) \
1414
$(foreach group,$(TESTGROUPS), \
1515
$(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/$(group)/*.jl)))
@@ -29,6 +29,22 @@ $(addprefix revise-, $(TESTS)): revise-% :
2929
@cd $(SRCDIR) && \
3030
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no --depwarn=error ./runtests.jl --revise $*)
3131

32+
relocatedepot:
33+
@rm -rf $(SRCDIR)/relocatedepot
34+
@cd $(SRCDIR) && \
35+
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no --depwarn=error ./runtests.jl $@)
36+
@cp -r $(build_datarootdir)/julia $(SRCDIR)/relocatedepot/
37+
@cd $(SRCDIR) && \
38+
$(call PRINT_JULIA, $(call spawn,RELOCATEDEPOT="" $(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no --depwarn=error ./runtests.jl $@)
39+
40+
revise-relocatedepot: revise-% :
41+
@rm -rf $(SRCDIR)/relocatedepot
42+
@cd $(SRCDIR) && \
43+
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no --depwarn=error ./runtests.jl --revise $*)
44+
@cp -r $(build_datarootdir)/julia $(SRCDIR)/relocatedepot/
45+
@cd $(SRCDIR) && \
46+
$(call PRINT_JULIA, $(call spawn,RELOCATEDEPOT="" $(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no --depwarn=error ./runtests.jl --revise $*)
47+
3248
embedding:
3349
@$(MAKE) -C $(SRCDIR)/$@ check $(EMBEDDING_ARGS)
3450

test/choosetests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TESTNAMES = [
2424
"some", "meta", "stacktraces", "docs", "gc",
2525
"misc", "threads", "stress", "binaryplatforms", "atexit",
2626
"enums", "cmdlineargs", "int", "interpreter",
27-
"checked", "bitset", "floatfuncs", "precompile",
27+
"checked", "bitset", "floatfuncs", "precompile", "movedepot",
2828
"boundscheck", "error", "ambiguous", "cartesian", "osutils",
2929
"channels", "iostream", "secretbuffer", "specificity",
3030
"reinterpretarray", "syntax", "corelogging", "missing", "asyncmap",

test/relocatedepot.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Test
2+
3+
4+
include("testenv.jl")
5+
6+
7+
@testset "compile and load relocated pkg" begin
8+
name = "DelimitedFiles"
9+
uuid = Base.UUID("8bb1440f-4735-579b-a4ab-409b98df4dab")
10+
pkg = Base.PkgId(uuid, name)
11+
if !relocated_depot
12+
# precompile
13+
Base.require(Main, :DelimitedFiles)
14+
@test Base.root_module_exists(pkg) == true
15+
else
16+
path = Base.locate_package(pkg)
17+
iscached = @lock Base.require_lock begin
18+
m = Base._require_search_from_serialized(pkg, path, UInt128(0))
19+
m isa Module
20+
end
21+
@test iscached == true # can load from cache
22+
Base.require(Main, :DelimitedFiles)
23+
@test Base.root_module_exists(pkg) == true
24+
end
25+
end

test/testenv.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if !@isdefined(testenv_defined)
3535
const rr_exename = ``
3636
end
3737

38+
const relocated_depot = haskey(ENV, "RELOCATEDEPOT")
39+
3840
function addprocs_with_testenv(X; rr_allowed=true, kwargs...)
3941
exename = rr_allowed ? `$rr_exename $test_exename` : test_exename
4042
addprocs(X; exename=exename, exeflags=test_exeflags, kwargs...)

0 commit comments

Comments
 (0)