Skip to content

Commit fb2ba43

Browse files
authored
hook up stdlib to the standard test running system (#24701)
* hook up stdlib to the standard test running system * fixups from review
1 parent 4914de4 commit fb2ba43

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

test/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
22
JULIAHOME := $(abspath $(SRCDIR)/..)
33
BUILDDIR := .
4+
STDLIBDIR := $(abspath $(JULIAHOME)/stdlib)
45
include $(JULIAHOME)/Make.inc
56
# TODO: this Makefile ignores BUILDDIR, except for computing JULIA_EXECUTABLE
67

78
TESTGROUPS = linalg sparse unicode strings dates
8-
TESTS = all $(TESTGROUPS) \
9+
TESTS = all stdlib $(TESTGROUPS) \
10+
$(patsubst $(STDLIBDIR)/%/,%,$(dir $(wildcard $(STDLIBDIR)/*/.))) \
911
$(filter-out TestHelpers runtests testdefs, \
1012
$(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/*.jl))) \
1113
$(foreach group,$(TESTGROUPS), \

test/choosetests.jl

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

3+
const STDLIB_DIR = joinpath(JULIA_HOME, "..", "share", "julia", "site", "v$(VERSION.major).$(VERSION.minor)")
4+
const STDLIBS = readdir(STDLIB_DIR)
5+
36
@doc """
47
58
`tests, net_on, exit_on_error, seed = choosetests(choices)` selects a set of tests to be
@@ -165,6 +168,20 @@ function choosetests(choices = [])
165168
filter!(x -> !(x in net_required_for), tests)
166169
end
167170

171+
if "stdlib" in skip_tests
172+
filter!(x -> (x != "stdlib" && !(x in STDLIBS)) , tests)
173+
elseif "stdlib" in tests
174+
filter!(x -> (x != "stdlib" && !(x in STDLIBS)) , tests)
175+
prepend!(tests, STDLIBS)
176+
end
177+
178+
if startswith(string(Sys.ARCH), "arm")
179+
# Remove profile from default tests on ARM since it currently segfaults
180+
# Allow explicitly adding it for testing
181+
warn("Skipping Profile tests")
182+
filter!(x -> (x != "Profile"), tests)
183+
end
184+
168185
filter!(x -> !(x in skip_tests), tests)
169186

170187
tests, net_on, exit_on_error, seed

test/runtests.jl

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,30 @@ else
1313
typemax(Csize_t)
1414
end
1515

16+
function test_path(test)
17+
if test in STDLIBS
18+
test_file = joinpath(STDLIB_DIR, test, "test", "runtests")
19+
if !isfile(test_file * ".jl")
20+
error("Standard library $test did not provide a `test/runtests.jl` file")
21+
end
22+
return test_file
23+
else
24+
return test
25+
end
26+
end
27+
1628
const node1_tests = String[]
1729
function move_to_node1(t)
1830
if t in tests
1931
splice!(tests, findfirst(equalto(t), tests))
2032
push!(node1_tests, t)
2133
end
2234
end
35+
2336
# Base.compile only works from node 1, so compile test is handled specially
2437
move_to_node1("compile")
38+
move_to_node1("SharedArrays")
39+
2540
# In a constrained memory environment, run the "distributed" test after all other tests
2641
# since it starts a lot of workers and can easily exceed the maximum memory
2742
max_worker_rss != typemax(Csize_t) && move_to_node1("distributed")
@@ -55,7 +70,7 @@ cd(dirname(@__FILE__)) do
5570
local resp
5671
wrkr = p
5772
try
58-
resp = remotecall_fetch(runtests, wrkr, test; seed=seed)
73+
resp = remotecall_fetch(runtests, wrkr, test, test_path(test); seed=seed)
5974
catch e
6075
resp = [e]
6176
end
@@ -105,9 +120,11 @@ cd(dirname(@__FILE__)) do
105120
# and either way, append the results
106121
# to the overall aggregator
107122
n > 1 && print("\tFrom worker 1:\t")
123+
isolate = true
124+
t == "SharedArrays" && (isolate = false)
108125
local resp
109126
try
110-
resp = eval(Expr(:call, () -> runtests(t, seed=seed))) # runtests is defined by the include above
127+
resp = eval(Expr(:call, () -> runtests(t, test_path(t), isolate, seed=seed))) # runtests is defined by the include above
111128
catch e
112129
resp = [e]
113130
end

test/stdlib.jl

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/testdefs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using Test
44

5-
function runtests(name, isolate=true; seed=nothing)
5+
function runtests(name, path, isolate=true; seed=nothing)
66
old_print_setting = Test.TESTSET_PRINT_ENABLE[]
77
Test.TESTSET_PRINT_ENABLE[] = false
88
try
@@ -19,7 +19,7 @@ function runtests(name, isolate=true; seed=nothing)
1919
@timed @testset $"$name" begin
2020
# srand(nothing) will fail
2121
$seed != nothing && srand($seed)
22-
include($"$name.jl")
22+
include($"$path.jl")
2323
end
2424
end
2525
res_and_time_data = eval(m, ex)

0 commit comments

Comments
 (0)