|
14 | 14 |
|
15 | 15 | args = Base.shell_split(get(ENV, "JULIA_MPIEXEC_TEST_ARGS", ""))
|
16 | 16 |
|
17 |
| -function runtests() |
18 |
| - nprocs = clamp(Sys.CPU_THREADS, 2, 4) |
19 |
| - testdir = dirname(@__FILE__) |
20 |
| - istest(f) = endswith(f, ".jl") && startswith(f, "test_") |
21 |
| - testfiles = sort(filter(istest, readdir(testdir))) |
| 17 | +nprocs = clamp(Sys.CPU_THREADS, 2, 4) |
| 18 | +testdir = @__DIR__ |
| 19 | +istest(f) = endswith(f, ".jl") && startswith(f, "test_") |
| 20 | +testfiles = sort(filter(istest, readdir(testdir))) |
22 | 21 |
|
23 |
| - nfail = 0 |
24 |
| - printstyled("Running MPI.jl tests\n"; color=:white) |
25 |
| - |
26 |
| - for f in testfiles |
27 |
| - mpiexec() do cmd |
28 |
| - cmd = `$cmd $args` |
29 |
| - if f == "test_spawn.jl" |
30 |
| - run(`$cmd -n 1 $(Base.julia_cmd()) $(joinpath(testdir, f))`) |
31 |
| - elseif f == "test_threads.jl" |
32 |
| - withenv("JULIA_NUM_THREAD" => "4") do |
33 |
| - run(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`) |
34 |
| - end |
35 |
| - elseif f == "test_error.jl" |
36 |
| - r = run(ignorestatus(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`)) |
37 |
| - @test !success(r) |
38 |
| - else |
| 22 | +@testset "$f" for f in testfiles |
| 23 | + mpiexec() do cmd |
| 24 | + cmd = `$cmd $args` |
| 25 | + if f == "test_spawn.jl" |
| 26 | + run(`$cmd -n 1 $(Base.julia_cmd()) $(joinpath(testdir, f))`) |
| 27 | + elseif f == "test_threads.jl" |
| 28 | + withenv("JULIA_NUM_THREAD" => "4") do |
39 | 29 | run(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`)
|
40 | 30 | end
|
| 31 | + elseif f == "test_error.jl" |
| 32 | + r = run(ignorestatus(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`)) |
| 33 | + @test !success(r) |
| 34 | + else |
| 35 | + run(`$cmd -n $nprocs $(Base.julia_cmd()) $(joinpath(testdir, f))`) |
41 | 36 | end
|
42 |
| - Base.with_output_color(:green,stdout) do io |
43 |
| - println(io,"\tSUCCESS: $f") |
44 |
| - end |
| 37 | + @test true |
45 | 38 | end
|
46 |
| - return nfail |
47 | 39 | end
|
48 |
| - |
49 |
| -exit(runtests()) |
0 commit comments