forked from JuliaGPU/CUDA.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.jl
30 lines (26 loc) · 903 Bytes
/
examples.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# these tests spawn subprocesses, so reset the current context to conserve memory
CUDA.device_reset!()
function find_sources(path::String, sources=String[])
if isdir(path)
for entry in readdir(path)
find_sources(joinpath(path, entry), sources)
end
elseif endswith(path, ".jl")
push!(sources, path)
end
sources
end
examples_dir = joinpath(@__DIR__, "..", "examples")
examples = find_sources(examples_dir)
filter!(file -> readline(file) != "# EXCLUDE FROM TESTING", examples)
cd(examples_dir) do
global examples
examples = relpath.(examples, Ref(examples_dir))
@testset for example in examples
cmd = Base.julia_cmd()
if Base.JLOptions().project != C_NULL
cmd = `$cmd --project=$(unsafe_string(Base.JLOptions().project))`
end
@test success(pipeline(`$cmd $example`, stderr=stderr))
end
end