Skip to content

Commit cd73466

Browse files
authored
Run tests in parallel (#496)
1 parent c174d3d commit cd73466

File tree

6 files changed

+47
-51
lines changed

6 files changed

+47
-51
lines changed

Project.toml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ FillArrays = "1.11"
2727
Images = "0.26"
2828
LinearAlgebra = "1"
2929
OffsetArrays = "1.0"
30+
ParallelTestRunner = "2"
3031
Random = "1"
3132
SparseArrays = "1"
3233
StaticArrays = "1"
@@ -40,21 +41,11 @@ BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
4041
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4142
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
4243
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
44+
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
4345
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4446
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
4547
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
4648
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4749

4850
[targets]
49-
test = [
50-
"Adapt",
51-
"Aqua",
52-
"BandedMatrices",
53-
"Documenter",
54-
"Images",
55-
"OffsetArrays",
56-
"SparseArrays",
57-
"StaticArrays",
58-
"Test",
59-
"Random",
60-
]
51+
test = ["Adapt", "Aqua", "BandedMatrices", "Documenter", "Images", "OffsetArrays", "ParallelTestRunner", "SparseArrays", "StaticArrays", "Test", "Random"]

test/runtests.jl

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
using BlockArrays, LinearAlgebra, Test
1+
using BlockArrays
2+
using ParallelTestRunner
23

3-
using Aqua
4-
downstream_test = "--downstream_integration_test" in ARGS
5-
@testset "Project quality" begin
6-
Aqua.test_all(BlockArrays, ambiguities=false,
7-
stale_deps=!downstream_test)
8-
end
4+
# Start with autodiscovered tests
5+
testsuite = find_tests(pwd())
96

10-
using Documenter
11-
@testset "docstrings" begin
12-
# don't test docstrings on old versions to avoid failures due to changes in types
13-
if v"1.10" <= VERSION < v"1.11.0-"
14-
DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true)
15-
doctest(BlockArrays, manual=false)
16-
end
7+
if "--downstream_integration_test" in ARGS
8+
delete!(testsuite, "test_aqua")
179
end
1810

19-
include("test_blockindices.jl")
20-
include("test_blockarrays.jl")
21-
include("test_blockviews.jl")
22-
include("test_blocks.jl")
23-
include("test_blockrange.jl")
24-
include("test_blockarrayinterface.jl")
25-
include("test_blockbroadcast.jl")
26-
include("test_blocklinalg.jl")
27-
include("test_blockproduct.jl")
28-
include("test_blockreduce.jl")
29-
include("test_blockdeque.jl")
30-
include("test_blockcholesky.jl")
31-
include("test_blockbanded.jl")
32-
include("test_adapt.jl")
11+
filtered_args = filter(!=("--downstream_integration_test"), ARGS)
12+
# Parse arguments
13+
args = parse_args(filtered_args)
14+
15+
runtests(BlockArrays, args; testsuite)

test/test_aqua.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module AquaTest
2+
3+
using BlockArrays
4+
using Test
5+
import Aqua
6+
7+
@testset "Project quality" begin
8+
Aqua.test_all(BlockArrays, ambiguities=false)
9+
end
10+
11+
end

test/test_blockindices.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ import BlockArrays: split_index, merge_indices
181181
@test sprint(show, "text/plain", Block{1}(1)) == "Block(1)"
182182
@test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)"
183183

184-
@test sprint(show, "text/plain", Block{0,BigInt}()) == "Block{0, BigInt}()"
185-
@test sprint(show, "text/plain", Block{1,BigInt}(1)) == "Block{1, BigInt}(1)"
184+
@test sprint(show, "text/plain", Block{0,BigInt}()) == "$Block{0, BigInt}()"
185+
@test sprint(show, "text/plain", Block{1,BigInt}(1)) == "$Block{1, BigInt}(1)"
186186
@test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)"
187187

188188
@test sprint(show, "text/plain", BlockIndex((1,2), (3,4))) == "Block(1, 2)[3, 4]"
@@ -398,7 +398,7 @@ end
398398
@test Base.dataids(b) == Base.dataids(blocklasts(b))
399399
@test_throws ArgumentError BlockedUnitRange(b)
400400

401-
@test summary(b) == "3-blocked 6-element BlockedUnitRange{$Int, Vector{$Int}}"
401+
@test summary(b) == "3-blocked 6-element $BlockedUnitRange{$Int, Vector{$Int}}"
402402
end
403403

404404
@testset "OneTo interface" begin
@@ -680,7 +680,7 @@ end
680680
@test Base.dataids(b) == Base.dataids(blocklasts(b))
681681
@test_throws ArgumentError BlockedOneTo(b)
682682

683-
@test summary(b) == "3-blocked 6-element BlockedOneTo{$Int, Vector{$Int}}"
683+
@test summary(b) == "3-blocked 6-element $BlockedOneTo{$Int, Vector{$Int}}"
684684
end
685685

686686
@testset "OneTo interface" begin

test/test_blockviews.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,9 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
201201
@test blocks(V) == blocks(A)[1:1,1:2]
202202
@test blocks(W) == blocks(A)[1:2,1:1]
203203
Vi = parentindices(V)
204-
@test sprint(show, "text/plain", V) == "1×3 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}, "*
205-
"$(typeof(axes(A)))}, $(Vi[1]), $(Vi[2])) "*
206-
"with eltype $Int with indices $(axes(V,1))×$(axes(V,2)):\n 1 │ 2 3"
204+
@test sprint(show, "text/plain", V) == "$(summary(V)):\n 1 │ 2 3"
207205
Wi = parentindices(W)
208-
@test sprint(show, "text/plain", W) == "3×1 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}"*
209-
", $(typeof(axes(A)))}, $(Wi[1]), $(Wi[2])) "*
210-
"with eltype $Int with indices $(axes(W,1))×$(axes(W,2)):\n 1\n\n 4\n 7"
206+
@test sprint(show, "text/plain", W) == "$(summary(W)):\n 1\n\n 4\n 7"
211207
end
212208

213209
@testset "getindex with BlockRange" begin
@@ -395,7 +391,7 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
395391
end
396392
bl = BlockedLogicalIndex(BlockedVector([true, true, false, false, true, false], [3, 3]))
397393
@test sprint(show, "text/plain", bl) ==
398-
"2-blocked 3-element BlockedVector{Int64, Base.LogicalIndex{Int64, BlockedVector{Bool, Vector{Bool}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}}}:\n 1\n 2\n\n 5"
394+
"$(summary(bl)):\n 1\n 2\n\n 5"
399395
@test checkbounds(Bool, randn(6), bl)
400396
@test !checkbounds(Bool, randn(5), bl)
401397
@test checkindex(Bool, 1:6, bl)

test/test_docstrings.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module DocstringsTest
2+
3+
using Documenter
4+
using Test
5+
import BlockArrays
6+
7+
@testset "docstrings" begin
8+
# don't test docstrings on old versions to avoid failures due to changes in types
9+
if v"1.10" <= VERSION < v"1.11.0-"
10+
DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true)
11+
doctest(BlockArrays, manual=false)
12+
end
13+
end
14+
15+
end

0 commit comments

Comments
 (0)