From 13af16e8445fbd8903ea3fdfefe92bdb7240ed87 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 1 Dec 2025 21:00:25 +0530 Subject: [PATCH 1/3] Run tests in parallel --- Project.toml | 16 +++------------- test/runtests.jl | 39 +++++++++++---------------------------- test/test_aqua.jl | 11 +++++++++++ test/test_blockindices.jl | 8 ++++---- test/test_blockviews.jl | 10 +++------- test/test_docstrings.jl | 15 +++++++++++++++ 6 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 test/test_aqua.jl create mode 100644 test/test_docstrings.jl diff --git a/Project.toml b/Project.toml index 67f1981c..abf56b3f 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,6 @@ name = "BlockArrays" uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" version = "1.9.3" - [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" BandedMatrices = "aae01518-5342-5314-be14-df237901396f" @@ -27,6 +26,7 @@ FillArrays = "1.11" Images = "0.26" LinearAlgebra = "1" OffsetArrays = "1.0" +ParallelTestRunner = "2" Random = "1" SparseArrays = "1" StaticArrays = "1" @@ -40,21 +40,11 @@ BandedMatrices = "aae01518-5342-5314-be14-df237901396f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" +ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = [ - "Adapt", - "Aqua", - "BandedMatrices", - "Documenter", - "Images", - "OffsetArrays", - "SparseArrays", - "StaticArrays", - "Test", - "Random", -] +test = ["Adapt", "Aqua", "BandedMatrices", "Documenter", "Images", "OffsetArrays", "ParallelTestRunner", "SparseArrays", "StaticArrays", "Test", "Random"] diff --git a/test/runtests.jl b/test/runtests.jl index 06d9bebb..3b616a0b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,32 +1,15 @@ -using BlockArrays, LinearAlgebra, Test +using BlockArrays +using ParallelTestRunner -using Aqua -downstream_test = "--downstream_integration_test" in ARGS -@testset "Project quality" begin - Aqua.test_all(BlockArrays, ambiguities=false, - stale_deps=!downstream_test) -end +# Start with autodiscovered tests +testsuite = find_tests(pwd()) -using Documenter -@testset "docstrings" begin - # don't test docstrings on old versions to avoid failures due to changes in types - if v"1.10" <= VERSION < v"1.11.0-" - DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true) - doctest(BlockArrays, manual=false) - end +if "--downstream_integration_test" in ARGS + delete!(testsuite, "test_aqua") end -include("test_blockindices.jl") -include("test_blockarrays.jl") -include("test_blockviews.jl") -include("test_blocks.jl") -include("test_blockrange.jl") -include("test_blockarrayinterface.jl") -include("test_blockbroadcast.jl") -include("test_blocklinalg.jl") -include("test_blockproduct.jl") -include("test_blockreduce.jl") -include("test_blockdeque.jl") -include("test_blockcholesky.jl") -include("test_blockbanded.jl") -include("test_adapt.jl") +filtered_args = filter(!=("--downstream_integration_test"), ARGS) +# Parse arguments +args = parse_args(filtered_args) + +runtests(BlockArrays, args; testsuite) \ No newline at end of file diff --git a/test/test_aqua.jl b/test/test_aqua.jl new file mode 100644 index 00000000..12d2e9a1 --- /dev/null +++ b/test/test_aqua.jl @@ -0,0 +1,11 @@ +module AquaTest + +using BlockArrays +using Test +import Aqua + +@testset "Project quality" begin + Aqua.test_all(BlockArrays, ambiguities=false) +end + +end diff --git a/test/test_blockindices.jl b/test/test_blockindices.jl index ef60822d..30d366f2 100644 --- a/test/test_blockindices.jl +++ b/test/test_blockindices.jl @@ -181,8 +181,8 @@ import BlockArrays: split_index, merge_indices @test sprint(show, "text/plain", Block{1}(1)) == "Block(1)" @test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)" - @test sprint(show, "text/plain", Block{0,BigInt}()) == "Block{0, BigInt}()" - @test sprint(show, "text/plain", Block{1,BigInt}(1)) == "Block{1, BigInt}(1)" + @test sprint(show, "text/plain", Block{0,BigInt}()) == "$Block{0, BigInt}()" + @test sprint(show, "text/plain", Block{1,BigInt}(1)) == "$Block{1, BigInt}(1)" @test sprint(show, "text/plain", Block{2}(1,2)) == "Block(1, 2)" @test sprint(show, "text/plain", BlockIndex((1,2), (3,4))) == "Block(1, 2)[3, 4]" @@ -398,7 +398,7 @@ end @test Base.dataids(b) == Base.dataids(blocklasts(b)) @test_throws ArgumentError BlockedUnitRange(b) - @test summary(b) == "3-blocked 6-element BlockedUnitRange{$Int, Vector{$Int}}" + @test summary(b) == "3-blocked 6-element $BlockedUnitRange{$Int, Vector{$Int}}" end @testset "OneTo interface" begin @@ -680,7 +680,7 @@ end @test Base.dataids(b) == Base.dataids(blocklasts(b)) @test_throws ArgumentError BlockedOneTo(b) - @test summary(b) == "3-blocked 6-element BlockedOneTo{$Int, Vector{$Int}}" + @test summary(b) == "3-blocked 6-element $BlockedOneTo{$Int, Vector{$Int}}" end @testset "OneTo interface" begin diff --git a/test/test_blockviews.jl b/test/test_blockviews.jl index c014326b..ca24f3cd 100644 --- a/test/test_blockviews.jl +++ b/test/test_blockviews.jl @@ -201,13 +201,9 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b) @test blocks(V) == blocks(A)[1:1,1:2] @test blocks(W) == blocks(A)[1:2,1:1] Vi = parentindices(V) - @test sprint(show, "text/plain", V) == "1×3 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}, "* - "$(typeof(axes(A)))}, $(Vi[1]), $(Vi[2])) "* - "with eltype $Int with indices $(axes(V,1))×$(axes(V,2)):\n 1 │ 2 3" + @test sprint(show, "text/plain", V) == "$(summary(V)):\n 1 │ 2 3" Wi = parentindices(W) - @test sprint(show, "text/plain", W) == "3×1 view(::BlockMatrix{$Int, Matrix{Matrix{$Int}}"* - ", $(typeof(axes(A)))}, $(Wi[1]), $(Wi[2])) "* - "with eltype $Int with indices $(axes(W,1))×$(axes(W,2)):\n 1\n ─\n 4\n 7" + @test sprint(show, "text/plain", W) == "$(summary(W)):\n 1\n ─\n 4\n 7" end @testset "getindex with BlockRange" begin @@ -395,7 +391,7 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b) end bl = BlockedLogicalIndex(BlockedVector([true, true, false, false, true, false], [3, 3])) @test sprint(show, "text/plain", bl) == - "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" + "$(summary(bl)):\n 1\n 2\n ─\n 5" @test checkbounds(Bool, randn(6), bl) @test !checkbounds(Bool, randn(5), bl) @test checkindex(Bool, 1:6, bl) diff --git a/test/test_docstrings.jl b/test/test_docstrings.jl new file mode 100644 index 00000000..d0729923 --- /dev/null +++ b/test/test_docstrings.jl @@ -0,0 +1,15 @@ +module DocstringsTest + +using Documenter +using Test +import BlockArrays + +@testset "docstrings" begin + # don't test docstrings on old versions to avoid failures due to changes in types + if v"1.10" <= VERSION < v"1.11.0-" + DocMeta.setdocmeta!(BlockArrays, :DocTestSetup, :(using BlockArrays); recursive=true) + doctest(BlockArrays, manual=false) + end +end + +end From 06892f91b39e63f456c43d543eabed989d6c39a6 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 1 Dec 2025 21:02:03 +0530 Subject: [PATCH 2/3] newline in Project.toml --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index abf56b3f..52ae1e63 100644 --- a/Project.toml +++ b/Project.toml @@ -2,6 +2,7 @@ name = "BlockArrays" uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" version = "1.9.3" + [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" BandedMatrices = "aae01518-5342-5314-be14-df237901396f" From 9bc67aaa83e5d09e6c43f618a082517390fb3666 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 1 Dec 2025 21:02:53 +0530 Subject: [PATCH 3/3] Newline in runtests --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3b616a0b..00f112d9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,4 +12,4 @@ filtered_args = filter(!=("--downstream_integration_test"), ARGS) # Parse arguments args = parse_args(filtered_args) -runtests(BlockArrays, args; testsuite) \ No newline at end of file +runtests(BlockArrays, args; testsuite)