Skip to content

Commit 1d7e5bc

Browse files
authored
Run tests in parallel using ParallelTestRunner (#363)
* Run tests in parallel using ParallelTestRunner * Remove local sources * Remove local sources * Rename files to uppercase names
1 parent ca09789 commit 1d7e5bc

File tree

4 files changed

+63
-71
lines changed

4 files changed

+63
-71
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ IntervalSets = "0.5, 0.6, 0.7"
4545
LazyArrays = "0.22, 1, 2"
4646
LinearAlgebra = "1"
4747
OddEvenIntegers = "0.1.8"
48+
ParallelTestRunner = "2"
4849
Polynomials = "2, 3, 4"
4950
Reexport = "0.2, 1"
5051
SpecialFunctions = "0.10, 1.0, 2"
@@ -57,10 +58,11 @@ julia = "1.6"
5758
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
5859
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
5960
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
61+
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
6062
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
6163
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
6264
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
6365
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6466

6567
[targets]
66-
test = ["Aqua", "DualNumbers", "Test", "Static", "StaticArrays", "LazyArrays", "Polynomials"]
68+
test = ["Aqua", "DualNumbers", "ParallelTestRunner", "Test", "Static", "StaticArrays", "LazyArrays", "Polynomials"]

test/Aqua.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using Aqua
2+
@testset "Project quality" begin
3+
Aqua.test_all(ApproxFunOrthogonalPolynomials, ambiguities=false, piracies = false)
4+
end

test/Helpers.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@testset "Domain" begin
2+
@test reverseorientation(Arc(1,2,(0.1,0.2))) == Arc(1,2,(0.2,0.1))
3+
end
4+
5+
@testset "helpers" begin
6+
for f in [isequalminhalf, isapproxminhalf]
7+
@test f(-0.5)
8+
@test f(static(-0.5))
9+
@test f(half(Odd(-1)))
10+
@test !f(-0.2)
11+
@test !f(half(Odd(1)))
12+
@test !f(1)
13+
@test !f(static(1))
14+
end
15+
@test !isequalhalf(-0.5)
16+
@test !isequalhalf(static(-0.5))
17+
@test !isequalhalf(half(Odd(-1)))
18+
@test !isequalhalf(-0.2)
19+
@test isequalhalf(0.5)
20+
@test isequalhalf(static(0.5))
21+
@test isequalhalf(half(Odd(1)))
22+
@test !isequalhalf(1)
23+
@test !isequalhalf(static(1))
24+
25+
@test isapproxhalfoddinteger(0.5)
26+
@test isapproxhalfoddinteger(static(0.5))
27+
@test isapproxhalfoddinteger(half(Odd(1)))
28+
@test !isapproxhalfoddinteger(1)
29+
@test !isapproxhalfoddinteger(static(1))
30+
31+
@test ApproxFunOrthogonalPolynomials._minonehalf(2) == -0.5
32+
@test ApproxFunOrthogonalPolynomials._onehalf(2) == 0.5
33+
end

test/runtests.jl

Lines changed: 23 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,35 @@
11
module ApproxFunOrthogonalPolynomials_Runtests
22

33
using ApproxFunOrthogonalPolynomials
4-
using ApproxFunOrthogonalPolynomials: isapproxminhalf, isequalminhalf, isequalhalf, isapproxhalfoddinteger
5-
using LinearAlgebra
6-
using Test
7-
using Aqua
8-
using Static
9-
using HalfIntegers
10-
using OddEvenIntegers
11-
12-
@testset "Project quality" begin
13-
Aqua.test_all(ApproxFunOrthogonalPolynomials, ambiguities=false, piracies = false)
14-
end
15-
16-
@testset "Domain" begin
17-
@test reverseorientation(Arc(1,2,(0.1,0.2))) == Arc(1,2,(0.2,0.1))
4+
using ParallelTestRunner
5+
6+
const init_code = quote
7+
using ApproxFunOrthogonalPolynomials
8+
using ApproxFunOrthogonalPolynomials: isapproxminhalf, isequalminhalf, isequalhalf, isapproxhalfoddinteger
9+
using LinearAlgebra
10+
using Test
11+
using Static
12+
using HalfIntegers
13+
using OddEvenIntegers
14+
using Test
15+
include("testutils.jl")
1816
end
1917

20-
# missing import bug
21-
@test ApproxFunOrthogonalPolynomials.Matrix === Base.Matrix
18+
# Start with autodiscovered tests
19+
testsuite = find_tests(pwd())
2220

23-
include("testutils.jl")
21+
# Parse arguments
22+
args = parse_args(ARGS)
2423

25-
@testset "helpers" begin
26-
for f in [isequalminhalf, isapproxminhalf]
27-
@test f(-0.5)
28-
@test f(static(-0.5))
29-
@test f(half(Odd(-1)))
30-
@test !f(-0.2)
31-
@test !f(half(Odd(1)))
32-
@test !f(1)
33-
@test !f(static(1))
24+
if filter_tests!(testsuite, args)
25+
# There are weird non-deterministic `ReadOnlyMemoryError`s on Windows,
26+
# so this test is disabled for now
27+
delete!(testsuite, "testutils.jl")
28+
if Sys.iswindows()
29+
delete!(testsuite, "UltrasphericalTest.jl")
3430
end
35-
@test !isequalhalf(-0.5)
36-
@test !isequalhalf(static(-0.5))
37-
@test !isequalhalf(half(Odd(-1)))
38-
@test !isequalhalf(-0.2)
39-
@test isequalhalf(0.5)
40-
@test isequalhalf(static(0.5))
41-
@test isequalhalf(half(Odd(1)))
42-
@test !isequalhalf(1)
43-
@test !isequalhalf(static(1))
44-
45-
@test isapproxhalfoddinteger(0.5)
46-
@test isapproxhalfoddinteger(static(0.5))
47-
@test isapproxhalfoddinteger(half(Odd(1)))
48-
@test !isapproxhalfoddinteger(1)
49-
@test !isapproxhalfoddinteger(static(1))
50-
51-
@test ApproxFunOrthogonalPolynomials._minonehalf(2) == -0.5
52-
@test ApproxFunOrthogonalPolynomials._onehalf(2) == 0.5
53-
end
54-
55-
include("ClenshawTest.jl"); GC.gc()
56-
include("MiscAFBTest.jl"); GC.gc()
57-
include("ChebyshevTest.jl"); GC.gc()
58-
# There are weird non-deterministic `ReadOnlyMemoryError`s on Windows,
59-
# so this test is disabled for now
60-
if !Sys.iswindows()
61-
include("UltrasphericalTest.jl"); GC.gc()
6231
end
63-
include("JacobiTest.jl"); GC.gc()
64-
include("LaguerreTest.jl"); GC.gc()
65-
include("HermiteTest.jl"); GC.gc()
66-
include("SpacesTest.jl"); GC.gc()
67-
include("ComplexTest.jl"); GC.gc()
68-
include("broadcastingtest.jl"); GC.gc()
69-
include("OperatorTest.jl"); GC.gc()
70-
include("ODETest.jl"); GC.gc()
71-
include("EigTest.jl"); GC.gc()
72-
include("VectorTest.jl"); GC.gc()
73-
include("MultivariateTest.jl"); GC.gc()
74-
include("PDETest.jl"); GC.gc()
7532

76-
include("SpeedTest.jl"); GC.gc()
77-
include("SpeedODETest.jl"); GC.gc()
78-
include("SpeedPDETest.jl"); GC.gc()
79-
include("SpeedOperatorTest.jl"); GC.gc()
80-
include("showtest.jl"); GC.gc()
33+
runtests(ApproxFunOrthogonalPolynomials, args; init_code, testsuite)
8134

8235
end # module

0 commit comments

Comments
 (0)