|
1 | 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license |
| 2 | + |
2 | 3 | using Test, LinearAlgebra, SparseArrays |
3 | 4 |
|
4 | 5 | include("util/gha.jl") |
5 | 6 |
|
6 | | -if Base.get_bool_env("SPARSEARRAYS_AQUA_TEST", false) |
7 | | - include("ambiguous.jl") |
8 | | -end |
9 | | - |
10 | | -include("allowscalar.jl") |
11 | | -include("fixed.jl") |
12 | | -include("higherorderfns.jl") |
13 | | -include("sparsematrix_constructors_indexing.jl") |
14 | | -include("sparsematrix_ops.jl") |
15 | | -include("sparsevector.jl") |
16 | | -include("issues.jl") |
| 7 | +testfiles = ["allowscalar.jl", "fixed.jl", "higherorderfns.jl", |
| 8 | + "sparsematrix_constructors_indexing.jl", "sparsematrix_ops.jl", |
| 9 | + "sparsevector.jl", "issues.jl"] |
17 | 10 |
|
18 | 11 | if Base.USE_GPL_LIBS |
19 | | - |
20 | | - include("cholmod.jl") |
21 | | - include("umfpack.jl") |
22 | | - include("spqr.jl") |
23 | | - include("linalg.jl") |
24 | | - include("linalg_solvers.jl") |
25 | | - |
26 | | - nt = @static if isdefined(Threads, :maxthreadid) |
27 | | - Threads.maxthreadid() |
28 | | - else |
29 | | - Threads.nthreads() |
30 | | - end |
31 | | - |
32 | | - # 1. If the OS is Windows and we are in GitHub Actions CI, we do NOT run |
33 | | - # the `threads` tests. |
34 | | - # 2. If the OS is Windows and we are NOT in GitHub Actions CI, we DO run |
35 | | - # the `threads` tests. |
36 | | - # - So, just as an example, if the OS is Windows and we are in |
37 | | - # Buildkite CI, we DO run the `threads` tests. |
38 | | - # 3. If the OS is NOT Windows, we DO run the `threads` tests. |
| 12 | + append!(testfiles, ["cholmod.jl", "umfpack.jl", "spqr.jl", "linalg.jl", |
| 13 | + "linalg_solvers.jl"]) |
39 | 14 | if Sys.iswindows() && is_github_actions_ci() |
40 | 15 | @warn "Skipping `threads` tests on Windows on GitHub Actions CI" |
41 | | - @test_skip false |
42 | 16 | else |
43 | | - @debug "Beginning the `threads` tests..." |
44 | | - |
45 | | - # Test multithreaded execution |
46 | | - @testset "threaded SuiteSparse tests" verbose = true begin |
47 | | - @testset "threads = $nt" begin |
48 | | - include("threads.jl") |
49 | | - end |
50 | | - # test both nthreads==1 and nthreads>1. spawn a process to test whichever |
51 | | - # case we are not running currently. |
52 | | - other_nthreads = nt == 1 ? 4 : 1 |
53 | | - @testset "threads = $other_nthreads" begin |
54 | | - let p, cmd = `$(Base.julia_cmd()) --depwarn=error --startup-file=no threads.jl` |
55 | | - p = run( |
56 | | - pipeline( |
57 | | - setenv( |
58 | | - cmd, |
59 | | - "JULIA_NUM_THREADS" => other_nthreads, |
60 | | - dir=@__DIR__()), |
61 | | - stdout = stdout, |
62 | | - stderr = stderr), |
63 | | - wait = false) |
64 | | - if !success(p) |
65 | | - error("SuiteSparse threads test failed with nthreads == $other_nthreads") |
66 | | - else |
67 | | - @test true # mimic the one @test in threads.jl |
68 | | - end |
69 | | - end |
70 | | - end |
71 | | - end |
72 | | - |
73 | | - @debug "Finished the `threads` tests..." |
| 17 | + push!(testfiles, "threads_suite.jl") |
74 | 18 | end |
75 | 19 | end |
| 20 | + |
| 21 | +# ParallelTestRunner comes from the Pkg.test target; Julia base CI runs this |
| 22 | +# file without it and falls back to the serial path. |
| 23 | +if Base.find_package("ParallelTestRunner") !== nothing |
| 24 | + using ParallelTestRunner |
| 25 | + # Auto CPU thread count detection in ParallelTestRunner is bad |
| 26 | + push!(ARGS, "--jobs=$(Sys.CPU_THREADS)") |
| 27 | + testsuite = Dict{String,Expr}(splitext(f)[1] => :(include($(joinpath(@__DIR__, f)))) |
| 28 | + for f in testfiles) |
| 29 | + runtests(SparseArrays, ARGS; testsuite) |
| 30 | +else |
| 31 | + foreach(include, testfiles) |
| 32 | +end |
0 commit comments